Amran
Amran

Reputation: 11

Quickbooks Web Connector - SOAP requested resource not found when using Python/Sypne

Im trying to write a python web service to integrate with Quickbooks Web Connector. Im using the Spyne api to do this but seem to be running into a problem where requested methods arent recognised. The code ive written is:

class QuickbooksSOAPService(ServiceBase):
    __tns__ = 'http://developer.intuit.com'

    @srpc(Unicode, Unicode, _returns=Array(Unicode), 
            _operation_name="http://developer.intuit.com/authenticate")
    def authenticate(strUserName, strPassword):

        print strUserName
        return ['','','','']

application = Application(
    [QuickbooksSOAPService], tns='http://developer.intuit.com',
    in_protocol = Soap11(),
    out_protocol = Soap11(),
    )

wsgi_application = WsgiApplication(application)

im publishing these web services via the Flask framework im using for the rest of my website, like so

app_obj.wsgi_app = DispatcherMiddleware(app_obj.wsgi_app, {
        '/qbwcwebservices': qbwcwebservices })

i've noticed some differences in the wsdl definition spyne generates vs what the official wsdl is defined as, for example:

spyne:

<wsdl:operation name="http://developer.intuit.com/authenticate">
    <soap:operation soapAction="http://developer.intuit.com/authenticate" style="document"/>
    <wsdl:input name="authenticate">
        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output name="authenticateResponse">
        <soap:body use="literal"/>
    </wsdl:output>
</wsdl:operation>

correct intuit version:

<wsdl:operation name="authenticate">
    <soap:operation soapAction="http://developer.intuit.com/authenticate" style="document"/>
    <wsdl:input>
        <soap:body use="literal"/>
    </wsdl:input><wsdl:output>
        <soap:body use="literal"/>
    </wsdl:output>
</wsdl:operation>

heres what pops up in the debug log

[2016-11-24 19:15:27,650] p6534 {/var/www/jumpr/env_dev_jumpr/local/lib/python2.7/site-packages/spyne/protocol/soap/soap11.py:105} DEBUG - ValueError: Deserializing from unicode strings with encoding declaration is not supported by lxml.
[2016-11-24 19:15:27,651] p6534 {/var/www/jumpr/env_dev_jumpr/local/lib/python2.7/site-packages/spyne/protocol/xml.py:356} DEBUG - Method request string: {http://developer.intuit.com/}authenticate
[2016-11-24 19:15:27,651] p6534 {/var/www/jumpr/env_dev_jumpr/local/lib/python2.7/site-packages/spyne/protocol/xml.py:357} DEBUG - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <authenticate xmlns="http://developer.intuit.com/">
      <strUserName>jumpadmin</strUserName>
      <strPassword>aaa</strPassword>
    </authenticate>
  </soap:Body>
</soap:Envelope>

[2016-11-24 19:15:27,652] p6534 {/var/www/jumpr/env_dev_jumpr/local/lib/python2.7/site-packages/spyne/protocol/xml.py:574} DEBUG - Response <soap11env:Envelope xmlns:soap11env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap11env:Body>
    <soap11env:Fault>
      <faultcode>soap11env:Client.ResourceNotFound</faultcode>
      <faultstring>Requested resource '{http://developer.intuit.com/}authenticate' not found</faultstring>
      <faultactor></faultactor>
    </soap11env:Fault>
  </soap11env:Body>
</soap11env:Envelope>

could the differences in the SOAP operation name and SOAP action name be causing this 'requested resource not found' issue? or am i missing something more obvious?

Upvotes: 1

Views: 576

Answers (0)

Related Questions