我写的自动交易机器人,使用Python和肥皂水SOAP客户端。SOAP和持久性
我想知道是否可以通过使用持久的SOAP调用来提高速度(就像在RESTful服务中使用Session一样)。
这里是我的要求是什么样子:
DEBUG:suds.client:sending to (http://api.betdaq.com/v2.0/ReadOnlyService.asmx)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.GlobalBettingExchange.com/ExternalAPI/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:None="http://www.GlobalBettingExchange.com/ExternalAPI/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<ns0:ExternalApiHeader xmlns="http://www.GlobalBettingExchange.com/ExternalAPI/" version="2" languageCode="en" username="****" password="****" applicationIdentifier="***"/>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:GetPrices>
<getPricesRequest xmlns="http://www.GlobalBettingExchange.com/ExternalAPI/" NumberForPricesRequired="1" NumberAgainstPricesRequired="1">
<MarketIds>9430420</MarketIds>
</getPricesRequest>
</ns0:GetPrices>
</ns1:Body>
</SOAP-ENV:Envelope>
而我得到的回应是:
DEBUG:suds.client:headers = {'SOAPAction': u'"http://www.GlobalBettingExchange.com/ExternalAPI/GetPrices"', 'Content-Type': 'text/xml; charset=utf-8'}
DEBUG:suds.client:http succeeded: *long xml here*
正如你可以看到我在每一个XML请求使用页眉为我的用户名和密码。但是当我得到回应时,标题中没有cookie。
我想知道是否有可能以某种方式插入饼干到我的请求或类似的东西来实现持久性。 (像RESTful服务使用Session)
从来没有真正起到用肥皂,但怎么样[这里](http://stackoverflow.com/questions/21587554/extracting-cookie-from-soap-response-in-suds)+咸菜(HTTPS:/ /docs.python.org/2/library/pickle.html)? – Arount
@Arount,你可以看到响应并没有真正返回我可以插入下一个请求的任何cookie。 – Marijus