ZSI를 사용하여 Python의 웹 서비스 클라이언트 - "Classless Struct는 사전을 얻지 못했습니다"

StackOverflow https://stackoverflow.com/questions/1496910

  •  19-09-2019
  •  | 
  •  

문제

간단한 웹 서비스를 위해 ZSI를 사용하여 Python에서 샘플 클라이언트를 작성하려고합니다. 웹 서비스 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')

문제의 이유는 매개 변수의 이름이 누락 되었기 때문입니다 (sic!) - 바보 같은 오류 ;-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top