2016-07-27 20 views
0

リクエストをSOAPサービスに転送するESBにAPI(REST)を公開したいと思います。WSO2 ESB - ApiからSOAPへの変換

私のAPIは、このようにdefininedさ:

<api xmlns="http://ws.apache.org/ns/synapse" name="__test" context="/mytest"> 

    <resource methods="GET" uri-template="/{symbol}"> 
     <inSequence> 

     <property name="symbol" expression="get-property('uri.var.symbol')"/> 

     <payloadFactory media-type="xml"> 
      <format> 
       <ser:getQuote xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd"> 
       <ser:request> 
         <xsd:symbol>$1</xsd:symbol> 
       </ser:request> 
      </ser:getQuote> 

      </format> 
      <args> 
       <arg evaluator="xml" expression="get-property('symbol')"/> 
      </args> 
     </payloadFactory> 

     <log level="full"/> 

     <send> 
      <endpoint> 
       <wsdl service="SimpleStockQuoteService" port="SimpleStockQuoteServiceHttpEndpoint" 
        uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/> 
      </endpoint> 
     </send> 
     </inSequence> 
    </resource> 
</api> 

しかし、私はhttpで、URLを呼び出すとき://:8280/MyTestに/ WSO2私はコンソール

<soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> 
<soapenv:Text xml:lang="en-US"> 
The endpoint reference (EPR) for the Operation not found is /services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpEndpoint/WSO2?request= and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator. 
</soapenv:Text> 
</soapenv:Reason> 

にこのエラーをheveので、 esbはURLのWSO2リクエストの一部を追加します。

どうすれば解決できますか? ありがとう

答えて

1

これを達成するためのガイドは、thisに従うことができます。 soap actionヘッダーは次のように追加する必要があり、エンドポイントは異なることに注意してください。 <header name="Action" value="urn:getQuote"/>
は、あなたが直接WSDLのURLを使用する場合は、WSO2 API Managerを使用して、これをachiveことができ、それが簡単にWSO2 API Cloudで試すことができ

<api xmlns="http://ws.apache.org/ns/synapse" name="__test" context="/mytest"><resource methods="GET" uri-template="/{symbol}"> 
    <inSequence> 
    <property name="symbol" expression="get-property('uri.var.symbol')"/> 
    <payloadFactory media-type="xml"> 
     <format> 
      <ser:getQuote xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd"> 
       <ser:request> 
       <xsd:symbol>$1</xsd:symbol> 
       </ser:request> 
      </ser:getQuote> 
     </format> 
     <args> 
      <arg evaluator="xml" expression="get-property('symbol')"/> 
     </args> 
    </payloadFactory> 
    <property name="REST_URL_POSTFIX" scope="axis2" action="remove"/> 
    <log level="full"/> 
    <header name="Action" value="urn:getQuote"/> 
    <send> 
     <endpoint> 
      <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/> 
     </endpoint> 
    </send> 
    </inSequence></resource></api> 

、以下の完全なソリューションのAPIを検索します。同様の質問hereがあります。