0

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

Community
  • 1
  • 1
Maforast
  • 257
  • 1
  • 6
  • 17

3 Answers3

1

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

Ragavan
  • 997
  • 7
  • 11
  • I have just see the first article but It Have a SOAP WS to backend. I have A REST SERVICE in backend instead. I cant find how I put POST var to my beckend REST SERVICE! – Maforast Oct 17 '13 at 15:28
  • Use REST_URL_POSTFIX property to append and construct query string, http://nuwanzone.blogspot.com/2012/07/invoke-rest-endpoint-from-soap-client.html, http://docs.wso2.org/display/ESB470/HTTP+Transport+Properties and in this post it is achieved through class mediator, http://stackoverflow.com/questions/14523977/wso2-synapse-setting-a-url-parameter – Ragavan Oct 17 '13 at 17:24
  • tnx for answer, REST_URL_POSTFIX help me to much in order to achieve a response to BackEnd service. But It don't put in right manner the "jobid" at the end of my endpoint address becoause I recive NOT_FOUND response But I expected FINISHED. MY api is:
    – Maforast Oct 18 '13 at 16:00
  • OK I make error on atribute to properties tags, it want expression="get-property('uri.var.jobId')" in place of value and it work. This for GET request Now i try with POST request. – Maforast Oct 18 '13 at 16:10
  • CAN ANYONE help me to pass POST vars and process this in madiator api? I do with this:
    but It doesn't work
    – Maforast Oct 20 '13 at 19:42
0

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()"/>
poohdedoo
  • 1,258
  • 1
  • 18
  • 42
  • Hi tnx for reply, I'd like to send My POST data in Api and not by curl, But I can't do that. i want pass My param to api by this curl call: curl http://192.168.43.68:8281/run/asequence=FASTA/bsequence=FA STA/email=maforast@libero.it and get this in api with this:
    But It doesn't work
    – Maforast Oct 18 '13 at 17:13
0

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=maforast@gmail.com -v

I don't find solution for save rest call to DB

Maforast
  • 257
  • 1
  • 6
  • 17