I want to create one proxy that:
1. A call service that performs authorization and gives the result OK or Fail (1st Service)
2. If Result is "OK", call the service
The problem is that when the 1st service returns a message:
<?xml version='1.0' encoding='utf-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <result> <status>OK</status> <message></message> </result> </soapenv:Body> </soapenv:Envelope>
And I give "filtering" in Out Sequence. Here is the XML:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="TestProxy" transports="https,http" statistics="disable" trace="enable" startOnLoad="true"> <target endpoint="AuthorizationService"> <outSequence> <log level="full" /> <filter xpath="/result/status='OK'"> <then> <send> <endpoint> <address uri="http://192.168.1.140:8080/axis2/services/TaskService.TaskServiceHttpEndpoint/getTask" /> </endpoint> </send> </then> <else> <makefault version="soap11"> <code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:VersionMismatch" /> <reason value="1" /> <role>2</role> <detail>3</detail> </makefault> </else> </filter> <log level="full" /> </outSequence> </target> </proxy>
When I launch my application, the ESB always displays a message:
16:08:59,358 [-] [HttpClientWorker-4] INFO Start : Log mediator 16:08:59,361 [-] [HttpClientWorker-4] INFO To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:0bc33821-c4f1-448e-a7dc-be4194be8e99, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><result><status>OK</status><message></message></result></soapenv:Body></soapenv:Envelope> 16:08:59,361 [-] [HttpClientWorker-4] INFO End : Log mediator 16:08:59,361 [-] [HttpClientWorker-4] INFO Start : Filter mediator 16:08:59,361 [-] [HttpClientWorker-4] INFO XPath expression : /result/status='OK' evaluates to false - executing the else path child mediators
It seems that the filter condition is always wrong.
What is the correct instruction for XPath in the filter?
source share