简体   繁体   中英

How do I pass a dynamic parameter as a part of the URL of a REST service while using WSO2 ESB Proxy Service?

I am trying to simply host a REST service as a proxy service in WSO2 ESB. I am using Custom Proxy to do this. When I run the created proxy, I am not able to pass parameters to the proxy service at run time. How do I do this?

My REST service will be hit on a URL of format: http://ip:host/requestMapping/ {name}

The parameter 'name' has to be passed from the UI through the ESB to the service through a proxy service hosted on the ESB. Can you help me with the steps to follow to make this work?

I tried using this page: http://wso2.com/library/articles/2013/12/restful-integration-with-wso2-esb/

But that is for creating APIs which I have been successfully in creating. But I am unable to do this using Proxy services.

Basically in my program, when the user interacts with the UI, he enters a name as input. This name has to be passed to the proxy service hosted in the ESB which should forward this as a path variable to my REST service.

Right now, my service body is:

<inSequence>
  <send>
   <endpoint>
   <http method="POST" uri-template="http://ip:port/resourceMapping/{uri.var.name}"></http>

    </endpoint>
   </send>
</inSequence>
<outSequence>
  <send></send>
</outSequence>

When I run this, instead of sending the name as entered by the user, it sends "uri.var.name" to the REST service. On the other hand, if I define a property tag and define a value for it and then do this, the REST service gets the value of the property that I have set. But I need this value to be sent dynamically by the user so I can't define property and value inside.

Please help me.

I think, the best approach is to use API in this case because the request to the ESB is REST and endpoint also accepting REST. This is the best practice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM