简体   繁体   English

如何在WSO2中以XML格式转换JSON消息

[英]How to transform a JSON message in XML in WSO2

I am relative new in WSO2 services in Java EE. 我是Java EE中WSO2服务的新手。 I started by the Tutorial, but i had some little difficulties because my lack of knowledge about services in general. 我从教程开始,但是由于缺乏有关服务的一般知识,我遇到了一些小困难。 My problem now is that i am trying to send a JSON message and receive the same message in XML format. 我现在的问题是我正在尝试发送JSON消息并以XML格式接收相同的消息。 I studied in the site and they talk about Formatter and Builder, but i had a lot of difficult to apply that in my project. 我在该网站上学习,他们谈论Formatter和Builder,但是在我的项目中应用它有很多困难。 I already tried with Data Mapper, putting him before the send in the return, but this always return the timeout message. 我已经尝试过使用Data Mapper,将他放在发送返回之前,但这总是返回超时消息。 And i tried with Payload Factory too, but i thinking that i am doing something wrong, because the same happens. 我也尝试过Payload Factory,但我认为自己做错了,因为同样的情况也会发生。 Someone know a tutorial or good video detailed to i be able to learn how to solve this problem? 有人知道我可以学习如何解决此问题的详细教程或优秀视频吗?

If someone could help me i would stay quiet grateful. 如果有人可以帮助我,我会保持安静的感激之情。 Thank you. 谢谢。

i hope you are expected to transform JSON to XML. 我希望您能将JSON转换为XML。

在此处输入图片说明

In order to achieve this, you can simply create an API like below 为了实现这一目标,您可以简单地创建一个如下所示的API

 <api xmlns="http://ws.apache.org/ns/synapse" name="JsonToXmlApi" context="/Test"> <resource methods="POST" uri-template="/xml/"> <inSequence> <property name="messageType" value="text/xml" scope="axis2"/> <header name="To" action="remove"/> <property name="RESPONSE" value="true" scope="default" type="STRING"/> <send/> </inSequence> </resource> </api> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM