我在WSO2ESB中部署了一个代理服务,用于从SOAPWS检索数据集,并且我有一个基于调用模板的序列的OutSequence。
我必须根据不同的请求将不同的WS响应传递到vfs传输编写的不同文件上。
实际顺序如下:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="seq_prova_con_template">
<call-template target="file">
<with-param name="filename" value="IstatAllDataflow-template.xml"></with-param>
</call-template>
</sequence>
我想换一个案例调解员,但我想了解如何“捕捉”信息以选择正确的案例。在示例中:
`<switch source="//m0:getQuote/m0:request/m0:symbol" xmlns:m0="http://services.samples/xsd">
<case regex="IBM">
<!-- the property mediator sets a local property on the *current* message -->
<property name="symbol" value="Great stock - IBM"/>
</case>
<case regex="MSFT">
<property name="symbol" value="Are you sure? - MSFT"/>
</case>
<default>
<!-- it is possible to assign the result of an XPath or JSON Path expression as well -->
<property name="symbol"
expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
xmlns:m0="http://services.samples/xsd"/>
</default>
`
我问自己如何设置switch case的源参数,我想知道是否有人已经实现了这样的解决方案,以便使用单个代理服务来区分不同于WS的答案。
我的顺序如下:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="seq_template_switch">
<switch xmlns:ns="http://org.apache.synapse/xsd" xmlns:m0="http://services.samples" source="??????">
<case regex="QueryStructure">
<call-template target="file">
<with-param name="filename" value="IstatAllDataflow-template.xml"></with-param>
</call-template>
</case>
<case regex="GetCompactData">
<call-template target="file">
<with-param name="filename" value="GetCompactData-template.xml"></with-param>
</call-template>
</case>
</switch>
</sequence>
我需要在请求消息的请求中从che方法中获取switch case的选项,以便在我请求一种答案时编写一个特定的文件,而在我请求另一种答案的时候编写另一个具有不同名称的文件。
[EDIT]日志文件包含以下内容:
TID: [0] [ESB] [2015-09-18 10:33:09,125] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:7cc540d3-2893-4b0e-8a24-ab4538236d45, Direction: response, Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><QueryStructureResponse xmlns="http://ec.europa.eu/eurostat/sri/service/2.0"><QueryStructureResult><RegistryInterface xmlns="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message"><Header><ID>IT1001</ID><Test>true</Test><Name xml:lang="en">ISTAT_JD_237</Name><Prepared>2001-03-11T15:30:47+01:00</Prepared><Sender id="ISTAT"><Name xml:lang="en">Italian Statistical Institute</Name><Contact>
选择有关标签的开关/案例调解器将非常有用
<QueryStructureResponse>
。我可以用这个标签代替
<GetCompactData>
例如我想创建一个由这两个标签中的一个驱动的开关/案例调解器。这将是理解如何使用XPath位置以及使用一个序列通过vfs传输区分不同文件中的SOAP应答的良好开端。选择要写入的文件将由WS的回答类型决定。