[英]How to convert the JSON in WSO2 ESB
I am trying to pass my JSON as a object to a WSO2 ESB. 我正在尝试将JSON作为对象传递给WSO2 ESB。 I am getting JSON like this: 我得到这样的JSON:
'{FIELDNAME":"NAME",FIELDVALUE:"KISHORE"}'
This JSON I need to pass my ESB as a dynamic column. 我需要将此JSON作为动态列传递给JSON。 But Its accepting like JSON {"NAME":"KISHORE"}
. 但是它的接受方式类似于JSON {"NAME":"KISHORE"}
。 How can I convert from above JSON to below one in WSO2 ESB. 如何在WSO2 ESB中将JSON格式转换为低于JSON格式。 If I get above one I am unable to pass to proxy. 如果我的分数高于1,则无法传递给代理。 If I get below one I will pass like this (//name/child::text())
then I will get value as "KISHORE" I was tried with ENRICH mediator but its not working. 如果低于1,我将像这样通过(//name/child::text())
那么我将获得“ KISHORE”的价值,我曾尝试过ENRICH介体,但无法正常工作。
<proxy xmlns="http://ws.apache.org/ns/synapse" name="test_dynamic" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<enrich>
<source type="body" clone="true"/>
<target type="property" property="RM"/>
</enrich>
<property name="RM" expression="//fieldname/child::text()" scope="default" type="STRING"/>
<log level="custom">
<property name="r_no" expression="get-property('R_no')"/>
<property name="r_value" expression="get-property('R_value')"/>
<property name="emp_d" expression="get-property('emp')"/>
<property name="RM" expression="get-property('RM')"/>
</log>
<log level="full"/>
</inSequence>
</target>
<description></description>
</proxy>
ANS: request, Envelope: ANS:请求,信封:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body><fieldname>e_no</fieldname><fieldvalue>5</fieldvalue></soapenv:Body>
</soapenv:Envelope>
I think you should send the JSON message like this: 我认为您应该像这样发送JSON消息:
'{"RECORD":{FIELDNAME":"NAME",FIELDVALUE:"KISHORE"}}'
then get the value by the "Property" mediator in WSO2 ESB, like 然后通过WSO2 ESB中的“属性”中介程序获取值,例如
<property name="FIELDNAME" expression="//FIELDNAME/text()" scope="default" type="STRING"/>
<property name="FIELDVALUE" expression="//FIELDVALUE/text()" scope="default" type="STRING"/>
The link provided below by WSO2 explains the exact usecase which you are interested in solving WSO2下面提供的链接说明了您有兴趣解决的确切用例
Steps: 脚步:
Follow this link for detailed info and actual proxy configuration 点击此链接以获取详细信息和实际的代理配置
https://docs.wso2.com/display/ESB480/Sample+440%3A+Converting+JSON+to+XML+Using+XSLT https://docs.wso2.com/display/ESB480/Sample+440%3A+Converting+JSON+to+XML+Using+XSLT
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.