mule http post json数据通过httpendpoint
使用mule http post json数据通过httpendpoint,mule,mule-component,Mule,Mule Component,使用mule-如何发布json数据以调用我的应用程序url并获得响应。我的json数据如下: { "Reservation" : { "reservation" : { "@id" : "123456789" }, "arrivingDate" : "03-09-2012", "departureDate" : "03-15-2012", "guestName" : "Fred",
mule
-如何发布json
数据以调用我的应用程序url并获得响应。我的json
数据如下:
{
"Reservation" : {
"reservation" : {
"@id" : "123456789"
},
"arrivingDate" : "03-09-2012",
"departureDate" : "03-15-2012",
"guestName" : "Fred",
"guestLastName" : "Davis",
"hotelID" : "03",
"room" : "1001",
"oceanView" : "true",
}
}
我想将我的json数据发布到我的应用程序
http://localhost:8080/myapplication/createreservation
通过MULE HTTP端点
并获得一些应用程序响应。欢迎任何建议。我想说的第一件事是您的JSON数据无效。。结尾不应该有逗号。。可能缺少一些属性
如果要将数据发布到外部应用程序,可以遵循以下示例:-
<flow name="BestelItems" doc:name="BestelItems">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<set-payload doc:name="Set Payload" value="{ "Reservation" : { "reservation" : { "@id" : "123456789" }, "arrivingDate" : "03-09-2012", "departureDate" : "03-15-2012", "guestName" : "Fred", "guestLastName" : "Davis", "hotelID" : "03", "room" : "1001", "oceanView" : "true"}}"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="ttp://localhost:8080/myapplication/createreservation" contentType="application/json" doc:name="HTTP"/>
</flow>
但是,如果您想将JSON数据发布到您自己的Mule应用程序中,那么您只需要流具有Http入站端点。。您可以发布来自任何Rest客户机或邮递员的数据
数据将通过rest客户端或Postman应用程序自动进入Mule流,如下所示:-
可以通过以下方式完成: