【问题标题】:WSO2 ESB - Api to Soap transformationWSO2 ESB - Api 到 Soap 的转换
【发布时间】:2016-07-28 00:30:29
【问题描述】:

我想在 ESB 上公开一个 API (REST),将请求转换为 SOAP 服务。

我的 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。

我该如何解决这个问题? 谢谢

【问题讨论】:

    标签: api soap wso2 esb


    【解决方案1】:

    您可以按照this 指南来实现此目的。请注意,肥皂动作标头应按如下方式添加,并且端点不同。 <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 中轻松尝试。有一个类似的问题here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多