ZSIを使用してPythonでWebサービスクライアント - 「クラスレス構造体は、辞書取得できませんでした」
質問
私は、単純なWebサービスのためのZSIを使ってPythonのサンプルクライアントを作成しようとしています。 WebサービスのWSDLには、次のされます:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/test/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="test" targetNamespace="http://www.example.org/test/">
<wsdl:message name="NewOperationRequest">
<wsdl:part name="NewOperationRequest" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="NewOperationResponse">
<wsdl:part name="NewOperationResponse" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="test">
<wsdl:operation name="NewOperation">
<wsdl:input message="tns:NewOperationRequest"/>
<wsdl:output message="tns:NewOperationResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testSOAP" type="tns:test">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="NewOperation">
<soap:operation soapAction="http://www.example.org/test/NewOperation"/>
<wsdl:input>
<soap:body namespace="http://www.example.org/test/" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body namespace="http://www.example.org/test/" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="test">
<wsdl:port binding="tns:testSOAP" name="testSOAP">
<soap:address location="http://localhost/test"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
たびに、私は次のコードを実行します:
from ZSI.ServiceProxy import ServiceProxy
service = ServiceProxy('test.wsdl')
service.NewOperation('test')
私は受け取ります:
(...)
/var/lib/python-support/python2.5/ZSI/TCcompound.pyc in cb(self, elt, sw, pyobj, name, **kw)
345 f = lambda attr: pyobj.get(attr)
346 if TypeCode.typechecks and type(d) != types.DictType:
--> 347 raise TypeError("Classless struct didn't get dictionary")
348
349 indx, lenofwhat = 0, len(self.ofwhat)
TypeError: Classless struct didn't get dictionary
私は、このエラーは、Googleを検索しましたし、私は同様の問題が、無応答とを記述したカップルの記事を見つけました。あなたがたがここで間違っている知っていますか? WSDLにエラーがあり、私はコードで何かを欠場かZSIにバグがあるのですか?
あなたは助けるために事前にありがとう: - )
解決
最後に、私は解決策を発見しました。
私は次のように実行する必要があります:
from ZSI.ServiceProxy import ServiceProxy
service = ServiceProxy('test.wsdl')
service.NewOperation(NewOperationRequest='test')
問題の理由は、パラメータの名前は(原文のまま!)欠落していたということでした - 愚かなエラー; - )
所属していません StackOverflow