Example #1
0
def capakey_request(client, action, *args):
    '''
    Utility function help making requests to the CAPAKEY service.

    :param client: A :class:`suds.client.Client` for the CAPAKEY service.
    :param string action: Which method to call, eg. `ListAdmGemeenten`.
    :returns: Result of the SOAP call.
    '''
    security = Security()
    token = UsernameDigestToken(client.capakey_user, client.capakey_password)
    security.tokens.append(token)
    client.set_options(wsse=security)

    cm = getattr(client.service, action)
    a = Action(cm.method.soap.action)
    mid = MessageID()
    t = To('http://ws.agiv.be/capakeyws/nodataset.asmx')
    client.set_options(soapheaders=[a.xml(), t.xml(), mid.xml()])

    return getattr(client.service, action)(*args)
Example #2
0
def capakey_request(client, action, *args):
    '''
    Utility function that helps making requests to the CAPAKEY service.

    :param client: A :class:`suds.client.Client` for the CAPAKEY service.
    :param string action: Which method to call, eg. `ListAdmGemeenten`.
    :returns: Result of the SOAP call.
    '''
    security = Security()
    token = UsernameDigestToken(client.capakey_user, client.capakey_password)
    security.tokens.append(token)
    client.set_options(wsse=security)

    cm = getattr(client.service, action)
    a = Action(cm.method.soap.action)
    mid = MessageID()
    t = To(cm.method.location)
    client.set_options(soapheaders=[a.xml(), t.xml(), mid.xml()])

    log.debug('Calling %s on CAPAKEY service.', action)
    return getattr(client.service, action)(*args)
Example #3
0
 def testTo(self):
     from crabpy.wsa import To
     t = To('http://ws.agiv.be/capakeyws/nodataset.asmx')
     to = Element('To', ns=wsa)
     to.setText('http://ws.agiv.be/capakeyws/nodataset.asmx')
     self.assertEqual(to, t.xml())
Example #4
0
 def testTo(self):
     from crabpy.wsa import To
     t = To('http://ws.agiv.be/capakeyws/nodataset.asmx')
     to = Element('To', ns=wsa)
     to.setText('http://ws.agiv.be/capakeyws/nodataset.asmx')
     self.assertEqual(to, t.xml())