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)
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)
def testAction(self): from crabpy.wsa import Action a = Action('http://soap.test.org/test') act = Element('Action', ns=wsa) act.setText('http://soap.test.org/test') self.assertEqual(act, a.xml())