[英]using enriching response payload from call mediator
I am calling a micro-service through my WSO2 ESB Config Language Call Mediator, I then pass the request to an enrich mediator to and then I log and use a respond mediator. 我正在通过WSO2 ESB Config语言调用介体调用微服务,然后将请求传递给丰富介体,然后登录并使用响应介体。
The issue I have is that the I can not even see the payload returned by the micro-service though my micro-service indicates that it was called and returned a response payload without any errors. 我遇到的问题是,尽管我的微服务表明它已被调用并返回了响应有效载荷,但没有任何错误,但我什至看不到微服务返回的有效载荷。 Secondly my sequence throws an error when I run it. 其次,我的序列在运行时会引发错误。 My error is below. 我的错误如下。
JsonUtil #writeAsJson. JsonUtil #writeAsJson。 Payload could not be written as JSON. 有效负载无法编写为JSON。 MessageID: urn:uuid:fe8d8ec5-473e-43c0-bc98-22a7211e2d86 [2018-06-08 12:30:26,209] [] ERROR - JsonStreamFormatter Error occurred while writing to application/json java.lang.reflect.InvocationTargetException MessageID:urn:uuid:fe8d8ec5-473e-43c0-bc98-22a7211e2d86 [2018-06-08 12:30:26,209] []错误-写入application / json java.lang.reflect.InvocationTargetException时发生了JsonStreamFormatter错误
Below is my sequence. 以下是我的顺序。
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="balanceEnquirySeq" trace="disable"
xmlns="http://ws.apache.org/ns/synapse">
<property expression="json-eval($.)" name="data_request"
scope="default" type="STRING" />
<log level="custom">
<property expression="json-eval($.)" name="in_request" />
</log>
<switch source="json-eval($.agentInstitutionCode)">
<case regex="001">
<payloadFactory media-type="json">
<format>{
"channel": "",
"type": "",
"customerId": $1,
"customerIdType": "",
"submissionTime": "",
"reqTranId": $2,
"passcode": ""
}
</format>
<args>
<arg evaluator="json" expression="$.agentAccountNumber" />
<arg evaluator="json" expression="$.requestID" />
</args>
</payloadFactory>
<log level="custom">
<property expression="json-eval($.)" name="CHANGED_REQUEST" />
</log>
<property name="messageType" scope="default" type="STRING"
value="application/json" />
<call >
<endpoint>
<http method="post" uri-template="http://127.0.0.1:8080/stanbic/dobalenquiry" />
</endpoint>
</call>
<enrich>
<source type="body" clone="true" />
<target type="property" action="child" property="org_type" />
</enrich>
<log level="full"/>
<respond />
</case>
</switch>
</sequence>
If I use a json validator and just put the content of your payloadFactory there then I get an error on line 3 and 7 if the property is empty. 如果我使用json验证程序,然后将有效负载工厂的内容放在那里,那么如果该属性为空,则会在第3行和第7行出现错误。 Try: 尝试:
"channel": "",
"type": "",
"customerId": "$1",
"customerIdType": "",
"submissionTime": "",
"reqTranId": "$2",
"passcode": ""
To see if that helps. 看看是否有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.