【问题标题】:Issue with getting response from WSO2 ESB version 4.8.1 proxy从 WSO2 ESB 版本 4.8.1 代理获取响应的问题
【发布时间】:2016-04-26 07:08:42
【问题描述】:

使用以下配置创建了一个代理和目标 inSequence。此代理应返回带有在有效负载中配置的内容的响应,即 (<status>01SUCCESS</status>)。正如预期的那样,wso2 4.9.0 中的响应是 <status>01SUCCESS</status>。使用的客户端是 Apache HTTP 客户端。但同样不会返回 wso2 esb 4.8.1 中的响应,但状态为 200。在这两种情况下,Java 版本都是 1.7.0_79。 请建议任何适用于 WSO2 ESB 4.8.1 的解决方案?

代理:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="buildResponse"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target inSequence="buildResponse" faultSequence="fault"/>
   <description/>
</proxy>

顺序:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="buildResponse" xmlns="http://ws.apache.org/ns/synapse">
    <property name="prop" scope="default" type="STRING" value="PROP"/>
    <log>
        <property expression="get-property('prop')" name="prop" xmlns:ns="http://org.apache.synapse/xsd"/>
    </log>
    <payloadFactory media-type="xml">
        <format>
            <status xmlns="">01SUCCESS</status>
        </format>
    </payloadFactory>
    <log>
        <property expression="$body" name="body" xmlns:ns="http://org.apache.synapse/xsd"/>
    </log>
    <header action="remove" name="To" scope="default"/>
    <property name="RESPONSE" scope="default" type="STRING" value="true"/>
    <send/>
</sequence>

【问题讨论】:

    标签: wso2 wso2esb wso2carbon


    【解决方案1】:

    如果您的请求是 DELETE 的 GET,您需要在发送中介之前删除 NO_ENTITY_BODY :&lt;property name="NO_ENTITY_BODY" scope="axis2" action="remove"/&gt;

    【讨论】:

      【解决方案2】:

      如果请求是HTTP POST,这个属性在序列中是必需的,即使我们为HTTP GET 请求包含没有任何问题。

      <property name="messageType" value="text/xml" scope="axis2" type="STRING"/>
      

      以下序列配置适用于 HTTP GET 和 POST 请求;因为 POST 请求所需的属性也包含在配置中。

       <?xml version="1.0" encoding="UTF-8"?>
          <sequence name="buildResponse" xmlns="http://ws.apache.org/ns/synapse">
              <property name="prop" scope="default" type="STRING" value="PROP"/>
              <log>
                  <property expression="get-property('prop')" name="prop" xmlns:ns="http://org.apache.synapse/xsd"/>
              </log>
              <payloadFactory media-type="xml">
                  <format>
                      <status xmlns="">01SUCCESS</status>
                  </format>
              </payloadFactory>
              <log>
                  <property expression="$body" name="body" xmlns:ns="http://org.apache.synapse/xsd"/>
              </log>
              <property name="messageType" value="text/xml" scope="axis2" type="STRING"/>
             <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
      
              <header action="remove" name="To" scope="default"/>
              <property name="RESPONSE" scope="default" type="STRING" value="true"/>
              <send/>
          </sequence>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-04-23
        • 1970-01-01
        • 2012-08-31
        • 2015-03-13
        • 1970-01-01
        • 1970-01-01
        • 2013-12-31
        • 1970-01-01
        相关资源
        最近更新 更多