Question

I have recently been tasked with the (brutal and bloody) task of developing a SOAP client in python 3.3 for Microsoft Dynamics GP 10 web services. After a day or so of wsdl slicing and dicing, I was finally able to create a client using suds-jurko. I can create and interact with the objects (types) defined in the wsdl. However, when I try to make any service calls, I inevitably receive a 400 Bad Request error. After a half day of research, I suspect this is related to the wsHttpBinding used by Dynamics GP 10 web services (the legacy wsdl, which uses basicHttpBinding works just fine).

First, can anyone confirm for me whether suds-jurko supports wsHttpBinding? I suspect that it does not, but I would like confirmation one way or the other so that I know whether or not I'm heading in the right direction.

Second, assuming suds-jurko does not support wsHttpBinding, what would I need to do to add support for wsHttpBinding to suds-jurko? I understand the basic differences between basicHttpBinding and wsHttpBinding, but I'm having a hard time finding any concrete resources about what a SOAP client needs to do differently in these two binding scenarios (the vast majority of the resources I'm finding online talk about how to configure a .NET webservice to use wsHttpBinding, which is of no use to me).

This is the request that my current client sends. How does this request differ (or does it) from a request generated by a client that supports wsHttpBinding?

HEADERS: {'Content-Type': 'application/soap+xml; charset=utf-8', 
          'Content-type':    'application/soap+xml; charset=utf-8',
          'SOAPAction': b'"http://schemas.microsoft.com/dynamics/gp/2010/01/ICompany/GetCompanyList"',
          'Soapaction': b'"http://schemas.microsoft.com/dynamics/gp/2010/01/ICompany/GetCompanyList"'}

MESSAGE: <?xml version="1.0" encoding="UTF-8"?>
         <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
           xmlns:ns0="http://schemas.microsoft.com/dynamics/gp/2010/01"
           xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
           xmlns:ns2="http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.GP"
           xmlns:ns3="http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.Common"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
             <SOAP-ENV:Header/>
             <ns1:Body>
                 <ns0:GetCompanyList>
                     <ns0:criteria>
                         <ns3:columns/>
                         <ns3:convertToUpperCaseRestriction/>
                         <ns3:restrictions/>
                         <ns2:Id>
                             <ns3:From>-32000</ns3:From>
                             <ns3:To>32000</ns3:To>
                         </ns2:Id>
                     </ns0:criteria>
                     <ns0:context>
                         <ns3:CultureName>en-US</ns3:CultureName>
                         <ns3:CurrencyType>Transactional</ns3:CurrencyType>
                         <ns3:OrganizationKey xsi:type="ns3:CompanyKey">
                             <ns3:Id>-1</ns3:Id>
                         </ns3:OrganizationKey>
                     </ns0:context>
                 </ns0:GetCompanyList>
             </ns1:Body>
         </SOAP-ENV:Envelope>

(I noticed the duplicate headers and wondered if that might have something to do with the 400 Bad Request error. I tried virtually the same code that suds-jurko uses using urllib.request but still ended up with the 400: Bad Request error without the duplicate headers)

Any suggestions and/or advice would be greatly appreciated. If you would like any more information from me, I will be more than happy to provide what I can. Thanks in advance.

Was it helpful?

Solution

After a lot of research, experimentation, and testing, I was able to find answers to most of my questions. Hopefully, someone can benefit from what I learned. We ended up going with the legacy endpoint.

In answer to my first question, suds-jurko does not support wsHTTPBinding. I'm not sure if anything does outside of the .NET world.

Adding wsHTTPBinding support for suds-jurko would be a substantial undertaking. You should be able to find information on the basic wsHTTPBinding specs here and here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top