我想使用WSDL通过SUDS发送我的hand build xml.我发现,我可以这样做:
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)
Run Code Online (Sandbox Code Playgroud)
但是使用这种方法SUDS发送:
<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>
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何在不添加任何SUDS的情况下发送我的XML?
use*_*450 12
根据suds文档,您可以使用__inject参数向您调用的方法发送原始SOAP消息:
client.service.GetAccountBalance(__inject={'msg': xml})
Run Code Online (Sandbox Code Playgroud)