【问题标题】:WSO2 ESB 4.8.1. Dynamic HTTP Endpoint Template does not workWSO2 ESB 4.8.1。动态 HTTP 端点模板不起作用
【发布时间】:2015-04-25 07:05:15
【问题描述】:

我正在使用 WSO2 ESB 4.8.1。我正在给后端服务打个休息电话。为此,我使用 HTTP 端点模板来制作动态端点。我从我的 URL 中选择值并将其传递给端点。

序列码:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="SampleSequence">
   <property xmlns:ns="http://org.apache.synapse/xsd" name="uri.var.myProperty" expression="get-property('uri.var.identityCode')" scope="default" type="STRING"></property>

   <send>
      <endpoint>
         <http method="get" uri-template="http://com.example?identityCode={uri.var.myProperty}"></http>
      </endpoint>
   </send>
</sequence>

问题: 该值已正确传递到属性中。但是端点没有接听它。这是正确的做法吗?

【问题讨论】:

    标签: wso2 wso2esb wso2carbon


    【解决方案1】:

    使用 REST_URL_POSTFIX[1] 创建查询字符串,如下所示

    <property name="val1" expression="get-property('uri.var.identityCode')"/>
    <property name="REST_URL_POSTFIX" expression="fn:concat('?identityCode=',$ctx:val1)"  scope="axis2"/>
    
    <send>
      <endpoint>
         <http method="get" uri-template="http://com.example"></http>
      </endpoint>
    </send>
    
    1. https://docs.wso2.com/display/ESB470/HTTP+Transport+Properties

    【讨论】:

    • 您链接到的文档明确表示 not 在 HTTP 端点的情况下执行此操作,而是按照@omerkhalid 在原始问题中提出的要求执行此操作试图做。据我所知,REST_URL_POSTFIX 仅适用于“地址”端点。
    • 嗨,使用“uri.var”。和“POST_TO_URI”属性,我们可以为 HTTP 端点实现这一点。你能看看下面吗? susankhanirmala.wordpress.com/2016/04/20/…
    猜你喜欢
    • 2015-05-05
    • 2013-07-05
    • 1970-01-01
    • 2014-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-24
    • 1970-01-01
    相关资源
    最近更新 更多