[英]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. 我正在尝试简单地将REST服务作为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} 我的REST服务将在以下格式的URL上命中: 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. 参数“名称”必须通过ESB从UI通过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/ 我尝试使用此页面: 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. 但这是为了创建我已经成功创建的API。 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. 基本上在我的程序中,当用户与UI交互时,他输入名称作为输入。 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.
该名称必须传递给ESB中托管的代理服务,该服务应将此名称作为路径变量转发给我的REST服务。
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. 当我运行此命令时,它不会发送用户输入的名称,而是将“ uri.var.name”发送到REST服务。 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.
另一方面,如果我定义一个属性标签并为其定义一个值,然后执行此操作,则REST服务将获取我已设置的属性的值。 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. 我认为,最好的方法是在这种情况下使用API,因为对ESB的请求是REST,并且端点也接受REST。 This is the best practice.
这是最佳做法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.