wso2esb - how to get the response of the rest api and pass that response to another service in wso2 esb? -


<resource methods="get" uri-template="/gettypecodes" faultsequence="service_error_handler_">   <insequence>      <log level="custom">         <property name="commonservice" value="*************gettypecodes called**************"/>         <property name="request payload" expression="get-property('json_object')"/>      </log>      <property name="http_method" value="get" scope="axis2" type="string"/>      <property name="messagetype" value="application/json" scope="axis2" type="string"/>      <sequence key="oauthmediationservice"/>      <property name="uri.var.servicename" value="commonservice"/>      <send>           <endpoint>            <address uri="http://localhost:8080/rest/commonservice/gettypecodes" format="rest"/>         </endpoint>      </send>      <log level="custom">         <property name="gettypecoderesponse" expression="$body"/>      </log>   </insequence>   <outsequence>      <send/>   </outsequence> 

from above rest example configuration calling service in endpoint. after calling endpoint need response , send response the endpoint based on condition.

you can use following configuration call reset service , response. in below sample i'm using http endpoint

<?xml version="1.0" encoding="utf-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse"        name="peopleputproxy"        transports="https,http"        statistics="disable"        trace="disable"        startonload="true">     <target>         <insequence>             <property name="http_method" value="get" scope="axis2"/>             <property name="messagetype"                       value="application/x-www-form-urlencoded"                       scope="axis2"/>             <send>                 <endpoint>                     <http method="post"                           uri-template="http://localhost:8080/rest/api/people?email={uri.var.email}&firstname={uri.var.fname}&lastname={uri.var.lname}"/>                     <property name="uri.var.fname" value="dhar"/>                     <property name="uri.var.email" value="kasun@gmail.com"/>                     <property name="uri.var.lname" value="kasun"/>                 </endpoint>             </send>         </insequence>         <outsequence>             <log level="full"/>             <property name="messagetype" value="text/xml" scope="axis2"/>             <send/>         </outsequence>     </target>     <description/> </proxy>  

http end point users can specify uri template can dynamically populate final uri restful service invocation. also, users can manipulate http method of outgoing request. please refer [1] more information on http endpoint

[1]. http://docs.wso2.org/display/esb470/http+endpoint


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -