在wso2 esb中创建rest服务时使用多个Uri模板
我创建了一个rest服务,如下所示:在wso2 esb中创建rest服务时使用多个Uri模板,rest,wso2,wso2esb,uritemplate,Rest,Wso2,Wso2esb,Uritemplate,我创建了一个rest服务,如下所示: <api xmlns="http://ws.apache.org/ns/synapse" name="GetCacheDataAPI" context="/GetCacheData/GetNotifications"> <resource methods="GET" uri-template="?ID={searchValue}" inSequence="GetNotificationsIN" outSequence="GetNoti
<api xmlns="http://ws.apache.org/ns/synapse" name="GetCacheDataAPI" context="/GetCacheData/GetNotifications">
<resource methods="GET" uri-template="?ID={searchValue}" inSequence="GetNotificationsIN" outSequence="GetNotificationsOUT"/>
</api>
在我的InSequenceGetNotificationsIN中,我的有效负载是:
<payloadFactory>
<format>
<p:Cache xmlns:p="http://tempuri/Notification/">
<in xmlns="">
<xs:ID xmlns:xs="http://tempuri/Notification/">$1</xs:ID>
<xs:TagName xmlns:xs="http://tempuri/Notification/">$2</xs:TagName>
<xs:Category xmlns:xs="http://tempuri/Notification/">$3</xs:Category>
<xs:State xmlns:xs="http://tempuri/Notification/">$4</xs:State>
<xs:SourceID xmlns:xs="http://tempuri/Notification/">$5</xs:SourceID>
</in>
</p:Cache>
</format>
<args>
<arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
<arg expression="get-property('uri.var.searchValue')"/>
</args>
</payloadFactory>
$1
$2
$3
$4
$5
现在,我已经传递了一个参数,即ID,并且工作正常。但我实现rest服务的实际服务接受五个参数,即ID、标记、源、状态和类别。在实际服务中,我可以传递任何一个参数,即ID、标记、源、状态或优先级,服务根据传递的参数为我提供数据
类似地,我想在我的rest服务中做完全相同的事情,即在uri模板中,我想实现这五个参数,从而使五个uri模板变量由逻辑or运算,因此,如果我用任何uri模板点击rest服务的url,它应该会给我来自实际服务的响应。我该怎么做?提前感谢如果存在大量查询,您可以使用
url映射=“/*”
而不是uri模板
。
检查此项感谢您的回复Ratha,我已经提供了有效载荷。您可以看到,有5个参数,用户可以根据上述参数中的任何一个过滤数据。现在假设我想根据源id获取数据,我会在浏览器中点击url吗?