如何读取WSO2 ESB中的http POST请求负载数据

问题描述:

我是wso2 esb的新手。我知道如何阅读http url参数。我有要求,我的代理将收到HTTP POST请求与有效载荷数据。我想知道如何读取代理服务器中的POST有效载荷数据。如何读取WSO2 ESB中的http POST请求负载数据

+0

你想对有效载荷做什么? – Bee

+0

欢迎使用stackoverflow。我正在投票结束这个问题,因为在国外是如此。你应该发布相关的代码,证明,至少,你有多远尝试... –

+0

@Bhathiya输入xml数据通过HTTP POST请求发送到客户端的有效载荷。所以,我想在wso2 esb中读取这些数据。你明白了..? – Kaliappan

如果您只是想对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"/>