我已经完成了以下配置。 创建代理发送JSON输入和Expectg JSON O / P,但没有让JSON返回IN故障序列。
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Get_Asset_Mobile" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence onError="fault">
<property name="CONTENT_TYPE" value="application/json" scope="axis2" type="STRING"/>
<payloadFactory>
<format>
<Select_Mobile_Asset_Op xmlns=""/>
</format>
</payloadFactory>
<send receive="Asset_Mobile_seq">
<endpoint>
<address uri="http://localhost:9764/services/masset_DataService/" format="soap11"/>
</endpoint>
</send>
<property xmlns:ns="http://org.apache.synapse/xsd" name="message" expression="get-property('ERROR_MESSAGE')"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="code" expression="get-property('ERROR_CODE')"/>
<log level="full"/>
</inSequence>
<outSequence onError="fault">
<property name="CONTENT_TYPE" value="application/json" scope="axis2" type="STRING"/>
<log level="full"/>
<drop/>
</outSequence>
</target>
<description></description>
</proxy>
上面一个是代理,低于FAULT Sequence。
<sequence xmlns="http://ws.apache.org/ns/synapse" name="fault">
<property name="CONTENT_TYPE" value="application/json" scope="axis2" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="message" expression="get-property('ERROR_MESSAGE')"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="code" expression="get-property('ERROR_CODE')"/>
<payloadFactory>
<format>
<Body xmlns="">
<Exception>$1</Exception>
<Status>$2</Status>
<Total>0</Total>
</Body>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('message')"/>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('code')"/>
</args>
</payloadFactory>
<send/>
<log level="full"/>
</sequence>
但是它没有反映客户端在WSO2 ESB终端消息中显示正确的消息,如下所示:
[2013-02-07 17:13:49,603] ERROR - ClientUtils The system cannot infer the transport information from the /services/Get_Asset_Mobile URL.
[2013-02-07 17:13:49,604] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: The system cannot infer the transport information from the /services/Get_Asset_Mobile URL.
at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:123)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:445)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:286)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:92)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:81)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:54)
at org.apache.synapse.endpoints.AbstractEndpoint.invokeNextFaultHandler(AbstractEndpoint.java:564)
at org.apache.synapse.endpoints.AbstractEndpoint.onFault(AbstractEndpoint.java:413)
at org.apache.synapse.endpoints.AddressEndpoint.onFault(AddressEndpoint.java:43)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:237)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:160)
at org.apache.synapse.transport.nhttp.ClientHandler$1.run(ClientHandler.java:494)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
[2013-02-07 17:13:49,604] INFO - LogMediator To: /services/Get_Asset_Mobile, MessageID: urn:uuid:793b3646-8342-4d75-a9b3-d41dc0ab5a2d, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><Body><Exception>Connection refused or failed for : localhost/127.0.0.1:9764, IO Exception occured : Connection refused</Exception><Status>101503</Status><Total>0</Total></Body></soapenv:Body></soapenv:Envelope>
两者都运作良好但不反映客户端。我关闭端点(wso2 DSS)并跟踪错误..请帮帮我。
答案 0 :(得分:0)
我认为你应该拥有的是:
&lt; property name =“messageType”value =“application / json”scope =“axis2”/&gt;
而不是CONTENT_TYPE。似乎这个属性没有定义。如果您的客户端是REST / JSON客户端,那么在inSequence中使用它就足够了。