如何使用wso2esb-4.8.1中的发送中介发送消息
我正在使用wso2esb-4.8.1, 我希望发送我的消息后,想做审计我的消息是出去,并得到审计也当我使用调出调解员Url选项我使用发送调解员URI它不工作。 示例代理和序列是如何使用wso2esb-4.8.1中的发送中介发送消息,wso2,wso2esb,wso2carbon,Wso2,Wso2esb,Wso2carbon,我正在使用wso2esb-4.8.1, 我希望发送我的消息后,想做审计我的消息是出去,并得到审计也当我使用调出调解员Url选项我使用发送调解员URI它不工作。 示例代理和序列是 <proxy xmlns="http://ws.apache.org/ns/synapse" name="Test_Proxy" transports="https http" startOnLoad="true" trace="disable"> <description/>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Test_Proxy" transports="https http" startOnLoad="true" trace="disable">
<description/>
<target>
<inSequence onError="FaultSeq">
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>
<log>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" name="ProxyInRequest"
expression="/soapenv:Envelope"/>
</log>
<xquery key="ProxyRequestTransformation">
<variable xmlns:ns="http://org.apache.synapse/xsd" name="Operation" expression="//Operation/text()" type="STRING"/>
<variable xmlns:ns="http://org.apache.synapse/xsd" name="ServiceNameSpace" expression="//ServiceNameSpace/text()" type="STRING"/>
<variable name="Payload" type="DOCUMENT_ELEMENT"/>
<variable xmlns:ns="http://org.apache.synapse/xsd" name="ServiceName" expression="//Service/text()" type="STRING"/>
</xquery>
<send>
<endpoint>
<address uri="http://localhost:8081/middleware/services/test1" format="soap11"/>
</endpoint>
</send>
</inSequence>
<outSequence onError="FaultSeq">
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<property action="set" name="RESPONSE" scope="default" type="STRING" value="true"/>
<send/>
<sequence key="AuditSeq"/>
</outSequence>
</target>
<publishWSDL key="EaiEnvelope"/>
</proxy>
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
Sexunce是这样的
<sequence xmlns="http://ws.apache.org/ns/synapse" name="AuditSeq"> <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="RESULT_CODE" expression="get-property('ResultCode')" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="RESULT_MESSAGE" expression="get-property('ResultMessage')" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="REFERENCE_ID" expression="get-property('ReferenceID')" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="FAULT_DETAILS" expression="concat(get-property('ERROR_CODE'),get-property('ERROR_MESSAGE'))" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<open:processRequest xmlns:open="http://www.openuri.org/">
<aud:Auditor xmlns:aud="http://jhm.kkk.fff/Auditor">
<aud:Request>
<aud:Operation_Name>processRequest</aud:Operation_Name>
<aud:Auditor_InputData>
<aud:Result_Code>$1</aud:Result_Code>
<aud:Result_Message>$2</aud:Result_Message>
<aud:Reference_Id>$3</aud:Reference_Id>
</aud:Auditor_InputData>
</aud:Request>
</aud:Auditor>
</open:processRequest>
</format>
<args>
<arg evaluator="xml" expression="get-property('RESULT_CODE')"/>
<arg evaluator="xml" expression="get-property('RESULT_MESSAGE')"/>
<arg evaluator="xml" expression="get-property('REFERENCE_ID')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="http://www.openuri.org/processRequest"/>
<send>
<endpoint>
<address uri="http://localhost:8081/middleware/services/AuditService" format="soap11"/>
</endpoint>
</send>
</sequence>
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
处理请求
$1
$2
$3
如果我使用send mediator配置,则不会调用它。其中,as callout mediator与URL选项配合良好,与addressendpoint配合良好
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
如果我使用下面的属性,它就可以正常工作了
我使用了这个属性,我得到的WSAction和soapAction为空
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
< header name="Action" scope="default" value="urn:http://www.openuri.org/processRequest"/>
<header action="remove" name="To"/>
<property action="set" name="RESPONSE" scope="default" type="STRING" value="true"/>
<property name="target.endpoint" value="AuditEndpoint"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
提前感谢首先,您必须更改代理中的异常顺序:
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
- 您应该使用clonemediator克隆响应消息
- 在第一个目标中,使用
- 在第二个目标中,使用
http://localhost:8081/middleware/services/AuditService
应该向您发回一个响应,您必须配置send mediator来处理此响应(您不希望再次调用来自代理的输出)=>您必须更改AuditSeq,向发送中介添加xml属性receive:
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
<send receive="AuditServiceResponse">
<endpoint>
<address uri="http://localhost:8081/middleware/services/AuditService" format="soap11"/>
</endpoint>
</send>
其中,AuditServiceResponse是一个序列(您可以记录或删除响应或任何您想要的内容)
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
所以,你是代理的后果应该是:
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
<outSequence onError="FaultSeq">
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<clone>
<target>
<sequence>
<send/>
</sequence>
</target>
<target>
<sequence>
<sequence key="AuditSeq"/>
</sequence>
</target>
</clone>
</outSequence>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="AuditSeq">
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>
<property name="RESULT_CODE" expression="get-property('ResultCode')" scope="default" type="STRING"/>
<property name="RESULT_MESSAGE" expression="get-property('ResultMessage')" scope="default" type="STRING"/>
<property name="REFERENCE_ID" expression="get-property('ReferenceID')" scope="default" type="STRING"/>
<property name="FAULT_DETAILS" expression="concat(get-property('ERROR_CODE'),get-property('ERROR_MESSAGE'))" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<open:processRequest xmlns:open="http://www.openuri.org/">
<aud:Auditor xmlns:aud="http://jhm.kkk.fff/Auditor">
<aud:Request>
<aud:Operation_Name>processRequest</aud:Operation_Name>
<aud:Auditor_InputData>
<aud:Result_Code>$1</aud:Result_Code>
<aud:Result_Message>$2</aud:Result_Message>
<aud:Reference_Id>$3</aud:Reference_Id>
</aud:Auditor_InputData>
</aud:Request>
</aud:Auditor>
</open:processRequest>
</format>
<args>
<arg evaluator="xml" expression="get-property('RESULT_CODE')"/>
<arg evaluator="xml" expression="get-property('RESULT_MESSAGE')"/>
<arg evaluator="xml" expression="get-property('REFERENCE_ID')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="http://www.openuri.org/processRequest"/>
<send receive="AuditServiceResponse">
<endpoint>
<address uri="http://localhost:8081/middleware/services/AuditService" format="soap11"/>
</endpoint>
</send>
</sequence>
您的顺序AuditSeq应该是:
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
<outSequence onError="FaultSeq">
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<clone>
<target>
<sequence>
<send/>
</sequence>
</target>
<target>
<sequence>
<sequence key="AuditSeq"/>
</sequence>
</target>
</clone>
</outSequence>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="AuditSeq">
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>
<property name="RESULT_CODE" expression="get-property('ResultCode')" scope="default" type="STRING"/>
<property name="RESULT_MESSAGE" expression="get-property('ResultMessage')" scope="default" type="STRING"/>
<property name="REFERENCE_ID" expression="get-property('ReferenceID')" scope="default" type="STRING"/>
<property name="FAULT_DETAILS" expression="concat(get-property('ERROR_CODE'),get-property('ERROR_MESSAGE'))" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<open:processRequest xmlns:open="http://www.openuri.org/">
<aud:Auditor xmlns:aud="http://jhm.kkk.fff/Auditor">
<aud:Request>
<aud:Operation_Name>processRequest</aud:Operation_Name>
<aud:Auditor_InputData>
<aud:Result_Code>$1</aud:Result_Code>
<aud:Result_Message>$2</aud:Result_Message>
<aud:Reference_Id>$3</aud:Reference_Id>
</aud:Auditor_InputData>
</aud:Request>
</aud:Auditor>
</open:processRequest>
</format>
<args>
<arg evaluator="xml" expression="get-property('RESULT_CODE')"/>
<arg evaluator="xml" expression="get-property('RESULT_MESSAGE')"/>
<arg evaluator="xml" expression="get-property('REFERENCE_ID')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="http://www.openuri.org/processRequest"/>
<send receive="AuditServiceResponse">
<endpoint>
<address uri="http://localhost:8081/middleware/services/AuditService" format="soap11"/>
</endpoint>
</send>
</sequence>
处理请求
$1
$2
$3
下面是一个示例AuditServiceResponse序列:
if i use below properties its working fine
<callout serviceURL="http:///localhost:8081/middleware/services/AuditService">
<source type="envelope"/>
<target key="IsThisResponse"/>
</callout>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="AuditServiceResponse">
<log level="full"/>
<drop/>
</sequence>
请参阅此以获取更多参考。我已将克隆与克隆一起使用。我正在根据您的指南将响应返回到客户端,但审计服务仍在运行。我还使用了drop mediator,即使它未被限制地插入。我无法停止它。我已更新我的响应:查看并验证您的定义。如果将“接收”序列添加到用于调用AuditService的“发送”中介,则不应无限期地调用它。如果仍然如此,请添加日志以确定要重播的序列