I have a wsld definition that looks like
...
<sequence>
<element name="version" nillable="false" type="xsd:string"/>
<element name="payment" nillable="false" type="tns1:payment"/>
...
</sequence>
...
This is the xml log of the request that is sent
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://impl.ws.payline.experian.com" ...>
<SOAP-ENV:Header/>
<ns2:Body>
<ns0:doWebPaymentRequest>
<ns0:version>
<ns0:version>4</ns0:version>
<ns0:payment>
<ns1:amount>33300</ns1:amount>
...
</ns0:payment>
</ns0:version>
...
So suds
encloses a payment
object into version
(a string), and it breaks the request. Why is that ?? Any way to go around this ?
For those wondering :
suds seems buggy when it comes to setting objects on the fly. But it seems to work fine for sending bare xml.
So what I did is have an xml file and replace part of it with what I need, and send it
file: obj.xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://impl.ws.payline.experian.com" ...>
...
<xxx>REPLACE_ME</xxx>
...
and the script :
client = Client(url='file://path/to/.wsdl')
xml_request = open('/path/to/obj.xml', 'rb').read()
xml_request = xml_request.replace('REPLACE_ME', value)
result = client.service.TheService(__inject={'msg': xml_request})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.