如何在WSO2 ESB中读取http POST请求有效负载数据

问题描述 投票:1回答:1

我是wso2 esb的新手。我知道如何读取http url参数。我要求我的代理将收到带有有效载荷数据的http POST请求。我想知道如何在代理中读取POST有效负载数据。

java web-services wso2 wso2esb wso2carbon
1个回答
2
投票

如果您只想进行REST到SOAP转换,则无需阅读消息正文。以下是Synapse配置示例。

<api xmlns="http://ws.apache.org/ns/synapse" name="TestAPI" context="/test">
   <resource methods="POST GET">
      <inSequence>
         <property name="SOAPAction" value="" scope="transport"/>
         <send>
            <endpoint>
               <address uri="http://demo8290629.mockable.io/test" format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </resource>
</api>

你可以这样称呼它。

curl -H "Content-Type:application/xml" -d '<ns:operationRequest xmlns:ns="http://demo8290629.mockable.io/service/1">testing</ns:operationRequest>' http://172.17.0.1:8280/test

但是,如果要将消息读取到属性,则可以这样做。

<property name="payload" expression="$body"/>
© www.soinside.com 2019 - 2024. All rights reserved.