2014-02-15 32 views
9

Ich möchte meine Hand bauen xml von SUDS mit WSDL. Ich fand, dass ich es so tun können:Senden von XML von SUDS

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) 

Aber mit Hilfe dieser SUDS Methode sendet:

<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> 

Meine Frage ist, wie kann ich meine XML senden, ohne etwas von SUDS Zugabe?

Antwort

13

Nach der Schaum Dokumentation können Sie eine rohe SOAP-Nachricht mit dem __inject Argument an die Methode senden Sie anrufen:

client.service.GetAccountBalance(__inject={'msg': xml}) 
+1

denke ich, was Sie versuchen, zu sagen, dass wir ersetzen müssen .GetAccutBalance() mit jeder Methode, die wir aufrufen möchten. Ich wurde durch die Verwendung des Wortes "Test" in der Dokumentation auch verwirrt. Es wäre einfacher zu sagen, rufen Sie die Methode, die Sie versuchen, mit handgemachten XML-String aufrufen. – Will

Verwandte Themen