omer khalid
omer khalid

Reputation: 895

WSO2 ESB 4.8.1. Dynamic HTTP Endpoint Template does not work

I am using WSO2 ESB 4.8.1. I am making a rest call to a back-end service. For that i am using HTTP Endpoint template to make the dynamic endpoint. I am picking value from my URL and passing it to the endpoint.

Sequence Code:

<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>

Problem: The value is correctly being passed into property. But the endpoint is not picking it up. Is this the right way to do it?

Upvotes: 1

Views: 842

Answers (1)

Jenananthan
Jenananthan

Reputation: 1401

Create the query string using REST_URL_POSTFIX[1] as follow

<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

Upvotes: 1

Related Questions