Question

I would like to send my hand build xml by SUDS using WSDL. I found, that I can do it like that:

xml = Raw("""
<SOAP-ENV:Envelope xmlns:ns0="urn:ca:std:cdc:tech:xsd:cdc.001.01" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      <ns0:GetAccountBalance>
         <ns0:Document>
            <myData>
                something
            </myData>
</ns0:Document>
      </ns0:GetAccountBalance>
   </ns1:Body>
</SOAP-ENV:Envelope>
    """)

print client.service.GetAccountBalance(xml)

But using this method SUDS sends:

<SOAP-ENV:Envelope xmlns:ns0="urn:ca:std:cdc:tech:xsd:cdc.001.01" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      <ns0:GetAccountBalance>
         <ns0:Document>
            <SOAP-ENV:Envelope xmlns:ns0="urn:ca:std:cdc:tech:xsd:cdc.001.01" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      <ns0:GetAccountBalance>
         <ns0:Document>
            <myData>
                something
            </myData>
</ns0:Document>
      </ns0:GetAccountBalance>
   </ns1:Body>
</SOAP-ENV:Envelope>
</ns0:Document>
      </ns0:GetAccountBalance>
   </ns1:Body>
</SOAP-ENV:Envelope>

My question is, how can I send my XML, without adding anything by SUDS?

Was it helpful?

Solution

According to the suds documentation, you can send a raw SOAP message using the __inject argument to the method you're calling:

client.service.GetAccountBalance(__inject={'msg': xml})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top