10

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?

1 Answers1

13

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})
Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144
  • 1
    I think what you're trying to say is that we have to substitute .GetAccoutBalance() with whatever method that we're trying to call. I got confused by the usage of the word "test" in the documentation also. It would be clearer to just say call the method you're trying to call using hand-made XML string. – Will Mar 25 '15 at 03:36