2009-09-30 5 views
1

간단한 웹 서비스에 ZSI를 사용하여 Python으로 샘플 클라이언트를 작성하려고합니다. 웹 서비스 WSDL은 다음입니다 : 내가 다음 코드를 실행할Python에서 ZSI를 사용하는 웹 서비스 클라이언트 - "클래스없는 구조체가 사전을 얻지 못했습니다"

<?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 

과 내가 찾은 몇 게시물을 유사한 문제를 기술하고 있지만 대답은 없다. 여기가 잘못되었다는 것을 알고 있습니까? WSDL에 오류가 있습니까? 코드에서 뭔가 빠져 있거나 ZSI에 버그가 있습니까?

도움을 주셔서 감사합니다 .-)

답변

3

마지막으로 해결책을 찾았습니다.

I는 다음과 같이 실행한다 : 문제의 이유는 매개 변수의 이름이 누락 된 것이 었습니다

from ZSI.ServiceProxy import ServiceProxy 
service = ServiceProxy('test.wsdl') 
service.NewOperation(NewOperationRequest='test') 

- 바보 오류 ;-)

을 (원문를!)