Reputation: 387
I'm wondering for solution to my Issue but I didn't find anything that can help me :(
THIS IS MY ISSUE: I'd like to call a remote REST web service by passing it trought an ESB to log the client call on DB. I'd like to pass a POST query var to my remote ws too, for example name=value & name2=value2!
I make a proxy service but I don't know how I can append the query variable to IT.
I can contact correctly remote ws with this proxy but I can't pass a POST VAR because I don't know how to do that.
I make a below curl call by client shell:
curl -k -i http://neanb330:8281/services/BioframeProxyService
in my proxy service I have this endpoint :
http://www.ebi.ac.uk/Tools/services/rest/emboss_matcher/run
BUT this service require two params in input and put out a jobid that I want to write in out sequence for client.
Have I to make a REST API? How I can Log client call on db?
Thanks
Upvotes: 0
Views: 1277
Reputation: 387
I find a solution for both GET and POST in Rest to rest scenario.
This for POST. I USE a proxy service and a curl call:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="BioframeProxyServiceRunBis"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="ContentType" value="text/xml" scope="axis2" type="STRING"/>
<switch source="$axis2:HTTP_METHOD">
<case regex="GET">
<property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/>
</case>
<case regex="POST">
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
</case>
<default/>
</switch>
<send>
<endpoint>
<address uri="http://www.ebi.ac.uk/Tools/services/rest/emboss_matcher/run/"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
curl -k -X POST https://neanb330:8244/services/BioframeProxyServiceRunBis -d asequence=FASTA -d bsequence=FASTA -d [email protected] -v
I don't find solution for save rest call to DB
Upvotes: 0
Reputation: 1268
If your question is how you can send data to your end point using curl then this is the way
curl -v --request POST -d '<Values><name1>ABC</name1><name2>Smith</name2></Values>' -H Content-Type:"text/xml" http://neanb330:8281/services/BioframeProxyService
Then you can get the values to ESB as shown below
<property name="name1" expression="//name1/text()"/>
<property name="name2" expression="//name2/text()"/>
Upvotes: 0
Reputation: 997
This post describes how to process rest requests within WSO2 ESB in detail with examples. http://wso2.com/library/articles/2012/09/get-cup-coffee-wso2-way/
This is the official documentation that explains rest url mapping
http://docs.wso2.org/display/ESB470/Getting+Started+with+REST+APIs
Upvotes: 1