0

我创建了一个休息服务:

<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>

在我的 InSequence GetNotificationsIN我的有效载荷是:

    <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>

现在,我在这里传递了一个参数,即 ID,并且工作正常。但是我实现其余服务的实际服务接受五个参数,它们是 ID、标签、源、状态和类别。在实际服务中,我可以传递任何一个参数,即 ID、标签、来源、状态或优先级,服务会根据传递的参数给我数据。

类似地,我想在我的休息服务中做同样的事情,即在 uri 模板中我想实现这五个参数,从而使五个 uri 模板变量被逻辑或分隔,这样如果我用任何 uri 打休息服务的 url模板它应该给我来自实际服务的响应。我怎样才能做到这一点?提前致谢

4

1 回答 1

2

如果有多个查询,您可以使用url-mapping="/*"而不是。uri-template检查这篇文章。

于 2013-06-20T15:05:02.523 回答