简体   繁体   English

使用来自呼叫中介器的丰富响应负载

[英]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>

如果我将有效负载放入JSON验证程序中,则会出现错误

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.

相关问题 是否可以从Call mediator处理HTML响应? - Is it possible to process HTML response from Call mediator? 如何使用 OMElement - WSO2 APIM ver 3.2.0 在响应路径类调解器处获取请求有效负载内容 - How to get Request payload content at Response path class mediator using OMElement - WSO2 APIM ver 3.2.0 使用有效负载工厂中介程序重建初始消息 - Rebuilding the initial message using the payload factory mediator 使用脚本中介调用中介 - Call Mediator with Script Mediator 使用阻止调用时聚合介体不起作用 - Aggregate mediator not working when using blocking call 通过WSO2 esb中的Payload Mediator传递所有默认响应值 - Pass all default response values through Payload Mediator in WSO2 esb WSO2 ESB如何测量呼叫或发送调解器的响应时间 - WSO2 ESB How to measure the response time of call or send mediator 如何避免在WSO2 EI中使用响应调解器忽略下一个调解器? - How to avoid ignore the next mediator using response mediator in WSO2 EI? WSO2 - 如何让调用中介忽略有效载荷(比如它是空的,甚至不是空的)? - WSO2 - how to make call mediator to ignore payload (like it is null, not even empty)? 需要删除 <text xmlns=“http://ws.apache.org/commons/ns/payload”> 从使用中的输出 - need to remove <text xmlns=“http://ws.apache.org/commons/ns/payload”> from output in using <xsl:output method="text> xslt mediator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM