Quickbooks Web Connector と統合する Python Web サービスを作成しようとしています。これを行うために Spyne API を使用していますが、要求されたメソッドが認識されないという問題が発生しているようです。書かれたコードは次のとおりです。
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)
私のウェブサイトの残りの部分に使用しているFlaskフレームワークを介してこれらのウェブサービスを公開しています。
app_obj.wsgi_app = DispatcherMiddleware(app_obj.wsgi_app, {
'/qbwcwebservices': qbwcwebservices })
spyneが生成するwsdl定義と、公式のwsdlが定義されているものとの違いに気づきました。たとえば、次のようになります。
スパイン:
<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>
正しい直感バージョン:
<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>
デバッグログに表示される内容は次のとおりです
[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>
SOAP 操作名と SOAP アクション名の違いが、この「要求されたリソースが見つからない」問題を引き起こしている可能性はありますか? または、もっと明白なものがありませんか?