2014-01-23 1 views
0

저는 비누와 관련하여 newb입니다 만, 여기에있는 것이 있습니다. perl의 SOAP :: Lite 라이브러리로 비누 호출을하면 모든 것이 멋지다. suds와 동일한 호출을하면 서버에서 오류가 발생합니다. 여기 python suds soap call 시작과 끝 태그 이름이 일치하지 않습니다

는 펄 호출에 의해 생성 된 작업 XML입니다 :

<?xml version="1.0" encoding="UTF-8"?> 
<soap:Envelope 
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:urn="urn:webservicesapi" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soap:Body> 
     <urn:getChassis xsi:nil="true" /> 
    </soap:Body> 
</soap:Envelope> 

비눗물과 같은 전화 걸기, 나는이 XML이

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope 
    xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns1="urn:webservicesapi" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 
    <SOAP-ENV:Header/> 
    <ns0:Body> 
     <ns1:getChassis/> 
    </ns0:Body> 
</SOAP-ENV:Envelope> 

을 생성받을 서버에 생성 된 오류는 다음과 같습니다 <ErrorCode>43</ErrorCode><Description>Start and end tag names don't match</Description>

브라우저에 비누 플러그인을 사용하는 경우이를 복제 할 수 있습니다. 본문을 다음과 같이 변경하면

<SOAP-ENV:Body> 
      <urn:getChassis xsi:nil="true" /> 
</SOAP-ENV:Body> 

호출이 제대로 작동합니다.

그래서 Body 및 urn의 접두사를 변경하는 방법을 알아야합니다. 또는 시작 및 끝 태그 이름이 일치하지 않는 이유를 이해해야합니다.

나는 그것이 송신되기 전에 suds.plugin 가져 오기 MessagePlugin에서 XML을 조작 할 수 있음을 알고 있지만, 여기를 잃어 버렸습니다.

도움이나 조언을 주시면 감사하겠습니다.

답변

0

확인. 작동하도록했습니다. 클라이언트 객체

client = Client(WSDL_LOCATION, transport=t, location=url, plugins=[EnvelopeFixer()]) 
를 만들 때

class EnvelopeFixer(MessagePlugin): 
    def marshalled(self, context): 
    context.envelope.getChild('ns0:Body').setPrefix('ns1') 

는 그럼 난 플러그인을 호출