簡體   English   中英

WSO2 ESB-Api到Soap的轉換

[英]WSO2 ESB - Api to Soap transformation

我想在ESB上公開一個將請求轉換為SOAP服務的API(REST)。

我的Api是這樣定義的:

 <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://:8280 / mytest / WSO2調用URL時,我在控制台上看到此錯誤

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

因為esb將請求的WSO2部分附加到URL。

我該如何解決? 謝謝

您可以按照指南來實現。 請注意,soap action標頭應如下添加,並且端點不同。 <header name="Action" value="urn:getQuote"/>
在下面找到完整的解決方案API,

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

如果您想直接使用WSDL URL,可以使用WSO2 API Manager來實現,並且可以在WSO2 API Cloud中輕松地嘗試。 還有一個類似的問題在這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM