[Tutor] Query with SOAP request generation, which other modules can be used.

ankur ~ अंकुर ganu.ullu at gmail.com
Wed May 23 06:13:16 CEST 2012


Dear Pythoneers,

We want to butile the SOAP request request in below manner. -

In header we want to pass the wsse auth part and custom transref section
and both has different xmlns.

------------------------------------------------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:com="http://some.xmlns.org/.1.0/Common.xsd" xmlns:bil="
http://some.xmlns.org/Schema/Billing/1.0/Billing.xsd">

   <soapenv:Header>

      <com:TransRef>
         <com:SourceSystemId>PORTAL</com:SourceSystemId>
         <com:TxID>123456</com:TxID>
         <com:BID>123456</com:BID>
      </com:TranRef>

<wsse:Security xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
">
         <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
">
            <wsse:Username>user</wsse:Username>
            <wsse:Password>pass</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>

   </soapenv:Header>

   <soapenv:Body>
      <bil:getBill>
         <bil:ID>1870000000</bil:ID>
      </bil:getBill>
   </soapenv:Body>

</soapenv:Envelope>
------------------------------------------------------------

Currently we are using pysimplesoap (
http://code.google.com/p/pysimplesoap/) module for this. The current
python code is attached.

But we are not able to pass the custom xmlns ( for bil and for com - the
very first line )  with pysimplesoap module.

*Any idea which other module we have to explore for generating the SOAP
request like above.*

Thank You,
Ankur.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120523/36541046/attachment.html>
-------------- next part --------------

from pysimplesoap.client import SoapClient
import sys,traceback

client = SoapClient(
location="http://www.abc.com/ABC/Billing",
action = "http://www.abc.org/Service/getBill",
namespace="http://www.abc.org/Service/Billing.wsdl",
trace=True)

client['wsse:Security'] = {
        'wsse:UsernameToken': {
                'wsse:Username': 'username',
                'wsse:Password': 'password',
        }
}

client['com:TransRef'] = {
        'com:SystemId': 'PORTAL',
        'com:TxID': '20012001161378998',
        'com:BID': '123456789'
}

try:
  response = client.getBill(AccountID=123456)
  print response
except:
  errortrace =  ''.join(traceback.format_exception(*sys.exc_info()))
  print("Unexpected error: %s" % (errortrace,))


More information about the Tutor mailing list