I trying to use the SOAP service based on "PHP SOAP server". And I have a problem with the argument passing. When it's a scalar argument, all is OK, but when I try to pass the structure there is a failure. Python libraries create arrays in the different format. In this example I'm using the SUDS but the other libraries don't makes "right format" too.
Service WSDL: http://www.drebedengi.ru/soap/dd.wsdl
PHP query:
$client = new SoapClient('http://www.drebedengi.ru/soap/dd.wsdl', array("trace" => 1));
$client->getRecordList(
'demo_api',
'[email protected]',
'demo',
array(
'is_report' => false,
'is_show_duty' => true,
'r_period' => 8,
'r_how' => 1,
'r_what' => 6,
'r_currency' => 0,
'r_is_place' => 0,
'r_is_tag' => 0,
)
)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ddengi"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getRecordList>
<apiId xsi:type="xsd:string">demo_api</apiId>
<login xsi:type="xsd:string">[email protected]</login>
<pass xsi:type="xsd:string">demo</pass>
<params xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">is_report</key>
<value xsi:type="xsd:boolean">false</value>
</item>
<item>
<key xsi:type="xsd:string">is_show_duty</key>
<value xsi:type="xsd:boolean">true</value>
</item>
<item>
<key xsi:type="xsd:string">r_period</key>
<value xsi:type="xsd:int">8</value>
</item>
<item>
<key xsi:type="xsd:string">r_how</key>
<value xsi:type="xsd:int">1</value>
</item>
<item>
<key xsi:type="xsd:string">r_what</key>
<value xsi:type="xsd:int">6</value>
</item>
<item>
<key xsi:type="xsd:string">r_currency</key>
<value xsi:type="xsd:int">0</value>
</item>
<item>
<key xsi:type="xsd:string">r_is_place</key>
<value xsi:type="xsd:int">0</value>
</item>
<item>
<key xsi:type="xsd:string">r_is_tag</key>
<value xsi:type="xsd:int">0</value>
</item>
</params>
<idList xsi:nil="true" />
</ns1:getRecordList>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Python query with SUDS:
client = suds.client.Client("http://www.drebedengi.ru/soap/dd.wsdl")
params = {
"is_report": False,
"is_show_duty": True,
"r_period": 8,
"r_how": 1,
"r_what": 6,
"r_currency": 0,
"r_is_place": 0,
"r_is_tag": 0
}
print client.service.getRecordList("demo_api", "[email protected]", "demo", params)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="urn:ddengi" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns4:getRecordList>
<apiId xsi:type="ns2:string">demo_api</apiId>
<login xsi:type="ns2:string">[email protected]</login>
<pass xsi:type="ns2:string">demo</pass>
<params xsi:type="ns0:params">
<is_report xsi:type="ns2:boolean">False</is_report>
<r_how xsi:type="ns2:int">1</r_how>
<r_currency xsi:type="ns2:int">0</r_currency>
<is_show_duty xsi:type="ns2:boolean">True</is_show_duty>
<r_is_tag xsi:type="ns2:int">0</r_is_tag>
<r_is_place xsi:type="ns2:int">0</r_is_place>
<r_what xsi:type="ns2:int">6</r_what>
<r_period xsi:type="ns2:int">8</r_period>
</params>
</ns4:getRecordList>
</ns1:Body>
</SOAP-ENV:Envelope>
I tried to use client.factory.create() but it doesn't work: types list is empty. There is the output of print client:
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913
Service ( ddengiService ) tns="urn:ddengi"
Prefixes (0)
Ports (1):
(SoapPort)
Methods (28):
deleteAll(xs:string apiId, xs:string login, xs:string pass, )
deleteObject(xs:string apiId, xs:string login, xs:string pass, xs:integer id, xs:string type, )
getAccessStatus(xs:string apiId, xs:string login, xs:string pass, )
getAccumList(xs:string apiId, xs:string login, xs:string pass, xs:anyType idList, )
getBalance(xs:string apiId, xs:string login, xs:string pass, xs:anyType params, )
getCategoryList(xs:string apiId, xs:string login, xs:string pass, xs:anyType idList, )
getChangeList(xs:string apiId, xs:string login, xs:string pass, xs:string revision, )
getCurrencyList(xs:string apiId, xs:string login, xs:string pass, xs:anyType idList, )
getCurrentRevision(xs:string apiId, xs:string login, xs:string pass, )
getExpireDate(xs:string apiId, xs:string login, xs:string pass, )
getOrderList(xs:string apiId, xs:string login, xs:string pass, xs:anyType idList, )
getPlaceList(xs:string apiId, xs:string login, xs:string pass, xs:anyType idList, )
getRecordList(xs:string apiId, xs:string login, xs:string pass, xs:anyType params, xs:anyType idList, )
getRightAccess(xs:string apiId, xs:string login, xs:string pass, )
getServerSubs(xs:string url, )
getSourceList(xs:string apiId, xs:string login, xs:string pass, xs:anyType idList, )
getSubscriptionStatus(xs:string apiId, xs:string login, xs:string pass, )
getTagList(xs:string apiId, xs:string login, xs:string pass, xs:anyType idList, )
getUserIdByLogin(xs:string apiId, xs:string login, xs:string pass, )
setAccumList(xs:string apiId, xs:string login, xs:string pass, xs:string list, )
setCategoryList(xs:string apiId, xs:string login, xs:string pass, xs:anyType list, )
setCurrencyList(xs:string apiId, xs:string login, xs:string pass, xs:anyType list, )
setPaymentTransaction(xs:string apiId, xs:string login, xs:string pass, xs:string transactionReceipt, xs:string amount, )
setPlaceList(xs:string apiId, xs:string login, xs:string pass, xs:anyType list, )
setRecordList(xs:string apiId, xs:string login, xs:string pass, xs:anyType list, )
setSourceList(xs:string apiId, xs:string login, xs:string pass, xs:anyType list, )
setTagList(xs:string apiId, xs:string login, xs:string pass, xs:anyType list, )
userRegister(xs:string apiId, xs:string login, xs:string name, xs:string lang, )
Types (0):
client.factory.create()to create params. Here's code exampleclient.factory.create()doesn't work because the types list is empty.print clientshows all the methods and 0 of types.params = client.factory.create('{http://xml.apache.org/xml-soap}Map')imp = Import('http://xml.apache.org/xml-soap') client = suds.client.Client("http://www.drebedengi.ru/soap/dd.wsdl", plugins=[ImportDoctor(imp)]) params = client.factory.create('{http://xml.apache.org/xml-soap}Map')