Mule - 使用 MEL 获取 SOAP 操作
Mule - Get SOAP operation with MEL
这是我的骡子流:
HTTP Listener
-> Logger
-> WS:Consumer
-> Logger
<flow name="ClientFlow" >
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<logger level="INFO" doc:name="Logger" message="#[message.payloadAs(java.lang.String)]"/>
<ws:consumer config-ref="Web_Service_Consumer" doc:name="Web Service Consumer" operation="NewRequestTest"/>
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
</flow>
我用 SOAPUI
:
向我的 mule 流发送了一条 SOAP 消息
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<NewRequestTest xmlns="urn:microsoft-dynamics-schemas/codeunit/Requests">
<xmlEntry>
<NewRequestTest>
<hiMessage>Hi</hiMessage>
<NewRequestTest>
</xmlEntry>
</NewRequestTest>
</soapenv:Body>
</soapenv:Envelope>
我想从 ws:consumer
动态地从 SOAP header 中使用 MEL expression
.[=19= 执行 操作 ]
通过什么方式可以获得该信息?
如果您的操作在请求的 body 某处指定,您可以只使用 xpath3 function,这样:
<set-variable variableName="operation" value="#[xpath('//theTagcontainingwhatyouwant')]" doc:name="Variable"/>
<ws:consumer config-ref="Web_Service_Consumer" doc:name="Web Service Consumer" operation="#[flowVars['operation']]"/>
请注意,理论上您也可以从通常伴随 soap 请求的 SOAP-Action header 进行操作,您可以通过 inboundProperties
访问它
#[message.inboundProperties['SOAPAction']]
希望对您有所帮助
这是我的骡子流:
HTTP Listener
-> Logger
-> WS:Consumer
-> Logger
<flow name="ClientFlow" >
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<logger level="INFO" doc:name="Logger" message="#[message.payloadAs(java.lang.String)]"/>
<ws:consumer config-ref="Web_Service_Consumer" doc:name="Web Service Consumer" operation="NewRequestTest"/>
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/>
</flow>
我用 SOAPUI
:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<NewRequestTest xmlns="urn:microsoft-dynamics-schemas/codeunit/Requests">
<xmlEntry>
<NewRequestTest>
<hiMessage>Hi</hiMessage>
<NewRequestTest>
</xmlEntry>
</NewRequestTest>
</soapenv:Body>
</soapenv:Envelope>
我想从 ws:consumer
动态地从 SOAP header 中使用 MEL expression
.[=19= 执行 操作 ]
通过什么方式可以获得该信息?
如果您的操作在请求的 body 某处指定,您可以只使用 xpath3 function,这样:
<set-variable variableName="operation" value="#[xpath('//theTagcontainingwhatyouwant')]" doc:name="Variable"/>
<ws:consumer config-ref="Web_Service_Consumer" doc:name="Web Service Consumer" operation="#[flowVars['operation']]"/>
请注意,理论上您也可以从通常伴随 soap 请求的 SOAP-Action header 进行操作,您可以通过 inboundProperties
访问它#[message.inboundProperties['SOAPAction']]
希望对您有所帮助