コード例 #1
0
ファイル: client.py プロジェクト: TalissaJoly/crabpy
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)
コード例 #2
0
ファイル: client.py プロジェクト: maarten-vermeyen/crabpy
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)
コード例 #3
0
ファイル: test_wsa.py プロジェクト: TalissaJoly/crabpy
 def testMessageId(self):
     from crabpy.wsa import MessageID
     mid = MessageID()
     # Test that we have the correct element. Ignores content.
     messageid = Element('MessageID', ns=wsa)
     self.assertEqual(messageid, mid.xml())
コード例 #4
0
 def testMessageId(self):
     from crabpy.wsa import MessageID
     mid = MessageID()
     # Test that we have the correct element. Ignores content.
     messageid = Element('MessageID', ns=wsa)
     self.assertEqual(messageid, mid.xml())