SOAPpy help needed


S

somemilk

Hi everyone.

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

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

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

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

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

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

But they do match!

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

Advertisements

P

Piet van Oostrum

somemilk said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top