SOAPpy help needed

Piet van Oostrum piet at cs.uu.nl
Wed Mar 18 11:38:07 EDT 2009


>>>>> somemilk <dushik at gmail.com> (D) wrote:

>D> Hi everyone.
>D> I have a PHP script which works and i need to write the same in Python
>D> but SOAPpy generates a slightly different request and i'm not sure how
>D> to fix it so the server likes it.

>D> The request generated by php script looks like this (removed http's
>D> from links):

>D> <?xml version="1.0" encoding="UTF-8"?>
>D> <SOAP-ENV:Envelope
>D> xmlns:SOAP-ENV="schemas.xmlsoap.org/soap/envelope/"
>D> xmlns:ns1="marketing.ews.yahooapis.com/V4"
>>> 
>D> <SOAP-ENV:Header>
>D> <ns1:username>*****</ns1:username>
>D> <ns1:password>*****</ns1:password>
>D> <ns1:masterAccountID>*****</ns1:masterAccountID>
>D> <ns1:accountID>6674262970</ns1:accountID>
>D> <ns1:license>*****</ns1:license>
>D> </SOAP-ENV:Header>
>D> <SOAP-ENV:Body>
>D> <ns1:getCampaignsByAccountID>
>D> <ns1:accountID>6674262970</ns1:accountID>
>D> <ns1:includeDeleted>false</ns1:includeDeleted>
>D> </ns1:getCampaignsByAccountID>
>D> </SOAP-ENV:Body>
>D> </SOAP-ENV:Envelope>

>D> When trying to make the same using SOAPPy i get this request:

>D> <?xml version="1.0" encoding="UTF-8"?>
>D> <SOAP-ENV:Envelope
>D> SOAP-ENV:encodingStyle="schemas.xmlsoap.org/soap/encoding/"
>D> xmlns:xsi="w3.org/1999/XMLSchema-instance"
>D> xmlns:SOAP-ENV="schemas.xmlsoap.org/soap/envelope/"
>D> xmlns:xsd="w3.org/1999/XMLSchema"
>>> 
>D> <SOAP-ENV:Header>
>D> <username xsi:type="xsd:string">*****</username>
>D> <masterAccountID xsi:type="xsd:string">*****</masterAccountID>
>D> <license xsi:type="xsd:string">*****</license>
>D> <accountID xsi:type="xsd:integer">6674262970</accountID>
>D> <password xsi:type="xsd:string">*****</password>
>D> </SOAP-ENV:Header>
>D> <SOAP-ENV:Body>
>D> <ns1:getCampaignsByAccountID xmlns:ns1="marketing.ews.yahooapis.com/
>D> V4">
>D> <includeDeleted xsi:type="xsd:boolean">False</includeDeleted>
>D> <accountID xsi:type="xsd:integer">6674262970</accountID>
>D> </ns1:getCampaignsByAccountID>
>D> </SOAP-ENV:Body>
>D> </SOAP-ENV:Envelope>

>D> A slightly different request but i guess it should work but i get an
>D> error from the server: "Account ID specified in the header does not
>D> match the one specified in the parameter."

>D> But they do match!

>D> The only thing i see is some difference in namespaces, but i have no
>D> idea what to do right now. Please help.

I see two differences. I don't think the namespaces are a problem. The
declarations are in different locations but that should not matter. The
real differences are:
1. The order of the parameters is different. This could well be the
   problem if the server is not paying attention to the parameter names
   but only to the order.
2. The types are included in Python. this is the RPC.encoded convention
   rather than RPC/literal. RPC/encoded is not WS-I compliant and I
   don't think SOAPpy supports it.

Actually I would guess number 1 is the culprit. Maybe you could use a
different SOAP implementation, e.g. suds
(https://fedorahosted.org/suds/). I haven't used it myself but had it
recommended by some of my students who used it for a project.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list