2014-10-16 1 views
3

안녕하세요!WSO2. SOAP 메시지를 XML로 변환하여 서비스로 보내는 방법은 무엇입니까?

는 최근

내 서비스가 요청을 받아 XML 형식으로 응답, 예를 WSO ESB를 공부를 시작 :

<!--The query in my service --> 
POST/HTTP/1.1 
Content-Type: text/xml; charset=utf-8 
Content-Length: 109  
<req> 
    <Value>How are you?</Value> 
</req> 

<!--The response from the service --> 
HTTP/1.1 200 OK 
Content-Length: 120 
Content-Type: text/xml; charset=utf-8  
<res> 
<Value>Very good!!!</Value> 
</res> 

나는 프록시를 통해 클라이언트에서 SOAP 요청을 변환 할 필요가 SOAP 클라이언트에서 XML과주고받는 서비스

예제 프록시 서비스의 SOAP 요청 및 응답

여기
<!--The request from the client to proxy service--> 
<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> 
    <Question xmlns="http://MyTestService"> 
     <Value>How are you?</Value> 
    </Question> 
    </soap:Body> 
</soap:Envelope> 

<!--Answer the service proxy to the client--> 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Body> 
    <QuestionResponse xmlns="http://CyberPlatService"> 
     <Fun1Result>Very good!!!</Fun1Result> 
    </QuestionResponse> 
    </s:Body> 
</s:Envelope> 

내가 뭘 잘못

<proxy xmlns="http://ws.apache.org/ns/synapse" name="CyberPlatProxy" transports="https http" 
     startOnLoad="true" trace="disable"> 
    <target> 
    <inSequence> 
     <payloadFactory media-type="xml"> 
     <format> 
      <req> 
      <Value>$1</Value> 
      </req> 
     </format> 
     <args> 
      <arg xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
      expression="//Question/Value"/> 
     </args> 
     </payloadFactory> 
     <property name="messageType" value="text/xml" scope="axis2" type="STRING"/> 
     <property name="DISABLE_CHUNKING" value="true" scope="axis2" type="STRING"/> 
     <log level="custom"/> 
     <send> 
     <endpoint> 
      <http method="post" uri-template="http://localhost:2009/"/> 
     </endpoint> 
     </send> 
    </inSequence> 
    <outSequence> 
     <payloadFactory media-type="xml" description="res"> 
     <format> 
      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
      <s:Body> 
       <GetStaysResponse xmlns="http://CyberPlatService"> 
       <GetStaysResult>$1</GetStaysResult> 
       </GetStaysResponse> 
      </s:Body> 
      </s:Envelope> 
     </format> 
     <args> 
      <arg expression="//Value"/> 
     </args> 
     </payloadFactory> 
     <property name="messageType" value="application/soap+xml" scope="axis2" type="STRING"/> 
     <send/> 
    </outSequence> 
    <faultSequence/> 
    </target> 
</proxy> 

아무런 변화가 없습니다 내 프록시 서비스입니다?

답변

3

은 "질문"노드가 http://MyTestService 네임 스페이스 그래서, 당신의 XPath는 //Question/Value이 작동하지 않을 수 속한, 당신은 변경해야합니다 :

<arg xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" expression="//Question/Value"/> 

에 :

<arg xmlns:test="http://MyTestService" expression="//test:Question/test:Value/text()"/> 
+0

감사합니다, 나는 수정했습니다. –

관련 문제