[Soap-Python] Can't get my request to work in pysimplesoap SoapClient

Mariano Reingart reingart at gmail.com
Tue Apr 28 00:22:33 CEST 2015


On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan <tmcallaghan at gmail.com>
wrote:

> Here's my code. When I "print bd.as_xml()" it looks good to me, but all
> that ends up in my <v2:response> is 2015-04-24T00:00:00, not
> <BusinessDate>
> 2015-04-24T00:00:00</BusinessDate>. Help.  -Tim
>
>
> -------- BEGIN CODE --------------
>
> from pysimplesoap.client import SoapClient
> from pysimplesoap.simplexml import SimpleXMLElement
>
> soapLocation="https://www.changed-for-example.com/Sales2.svc
> <https://api5.brinkpos.net/Sales2.svc>"
> soapAction="
> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/
> <http://www.brinksoftware.com/webservices/sales/v2/ISalesWebService2/>"
> nsValue="v2"
> namespaceValue="http://www.changed-for-example.com/webservices/sales/v2
> <http://www.brinksoftware.com/webservices/sales/v2>"
> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':'
> **NOT*THE*REAL*TOKEN'}
>
> client =
> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders)
>
> bd = SimpleXMLElement("<BusinessDate>2015-04-24T00:00:00</BusinessDate>")
>
> response = client.GetOrders(request=bd)
>
>
>
Can you test the following code instead calling client.getOrders directly?

response = client.call("GetOrders", bd)

That will detect bd as a raw simple xml object to be serialized.
That generates the following output (with BusinessDate included):

INFO:pysimplesoap.client:POST https://www.changed-for-example.com/Sales2.svc
DEBUG:pysimplesoap.client:SOAPAction: "
http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders
"
Content-length: 296
Content-type: text/xml; charset="UTF-8"
AccessToken: **NOT*THE*REAL*TOKEN
LocationToken: **NOT*THE*REAL*TOKEN
DEBUG:pysimplesoap.client:<?xml version="1.0"
encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="
http://www.changed-for-example.com/webservices/sales/v2">
<soapenv:Header/>
<soapenv:Body><BusinessDate>2015-04-24T00:00:00</BusinessDate></soapenv:Body></soapenv:Envelope>

BTW, from where did you get the response=raw syntax?

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20150427/457d8150/attachment-0001.html>


More information about the Soap mailing list