如何使用wso2代理服务向restful Web服务发送json请求
我是wso2的新手。。我问了很多关于wso2代理服务的问题,我没有得到正确的回答,有人能帮我吗 我想使用WSO2代理服务向Restful Web服务发送JSON请求。。我已尝试了以下配置如何使用wso2代理服务向restful Web服务发送json请求,wso2,wso2esb,wso2carbon,Wso2,Wso2esb,Wso2carbon,我是wso2的新手。。我问了很多关于wso2代理服务的问题,我没有得到正确的回答,有人能帮我吗 我想使用WSO2代理服务向Restful Web服务发送JSON请求。。我已尝试了以下配置 <target> <inSequence> <log level="custom"> <property name="in seq --------------of proxy" expression="$trp:Cont
<target>
<inSequence>
<log level="custom">
<property name="in seq --------------of proxy" expression="$trp:Content-Type"/>
</log>
<property name="messageType" value="application/json" scope="axis2" type="STRING"/>
<log level="custom">
<property name="in seq --------------of proxy" expression="$trp:Content-Type"/>
</log>
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<send>
<endpoint>
<address uri="http://10.132.97.131:9763/RESTfulExample/rest/json/metallica/post/"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence>
<log level="full">
<property name="MESSAGE" value="Executing default "fault" sequence"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
</faultSequence>
</target>
但是看到下面的错误,它没有正确通过
Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><Body></Body></soapenv:Envelope>
信封:
它正在尝试以SOAP(xml格式)的形式发送
我必须为此执行什么配置?我使用的是wso2 carbon 4.2.0,并在此基础上安装了ESB
请帮助我获得正确的代理服务确认
提前非常感谢您使用的json构建器是什么?能否将消息格式化程序更改为
,将消息生成器更改为
@Wenod我已检查axis2.xml
是否正确there@Wenod我更改了,现在我收到以下错误我将json请求作为`{“title”:“Enter Sandman”,“singer”:“Metallica”}“头衔和歌手是POJO类的两个变量Track@Wenod正确地得到了响应..非常感谢,,我在发送之前设置了,因此它正确地格式化了JSON并得到了响应(JSON)..):services/EventMastroProxyService.EventMastroProxyServiceHttpEndpoint?method=POST,From:10.132.97.131,Direction:request,MESSAGE=执行默认的“fault”序列,ERROR\u CODE=0,ERROR\u MESSAGE=发送消息时出现意外错误,信封:输入SandmanMetallica
@Wenod下面是我的RestFul服务POST方法@POST@Path(“/POST”)@Consumes(MediaType.APPLICATION\u JSON)公共响应createTrackInJSON(Track){System.out.println(“Tack Object”+track);Gson Gson=new Gson();String json=Gson.toJson(track);return Response.status(201).entity(json.build();}
{"title":"Enter Sandman","singer":"Metallica"}
Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><Body></Body></soapenv:Envelope>