1

動作するPHPスクリプトがあり、Pythonで同じものを書く必要がありますが、SOAPpyはわずかに異なるリクエストを生成し、サーバーが気に入るように修正する方法がわかりません.

php スクリプトによって生成されるリクエストは次のようになります。

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://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>

SOAPPy を使用して同じものを作成しようとすると、次の要求が表示されます。

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.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="http://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>

少し異なるリクエストですが、うまくいくはずですが、サーバーからエラーが発生します:「アカウントIDは

ヘッダーがパラメーターで指定されたものと一致しません。」

しかし、彼らは一致します!

私が目にするのは名前空間の違いだけですが、今何をすべきかわかりません。助けてください。

4

2 に答える 2

2

問題はSOAPヘッダーの形式ではなく、パラメーターの順序だけでした。完全な説明とコードは次のとおりです。http://pea.somemilk.org/2009/04/05/yahoo-search-marketing-python-soap-binding/

于 2009-04-17T14:54:47.440 に答える
0

accountID は、xsd:integer ではなく xsd:string 型である必要があります。(たぶん、整数の代わりに文字列を渡しているので、SOAPpy はそのようにしますか?)

于 2009-03-18T10:46:21.603 に答える