问题描述
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" contentType="application/x-www-form-urlencoded" path="getDetails" />
<object-to-string-transformer doc:name="Object to String"/>
<logger message=" Logging ...... #[message.payload]" level="INFO" doc:name="Logger"/>
<logger level="INFO" message=" Logging mule.......#[message.payloadAs(java.lang.String)]" doc:name="Logger"/>
<logger level="INFO" message="Logging demo .......... #[payload]" doc:name="Logger"/>
我通过chrome rest客户调用
i invoke thru chrome rest client
http://localhost:8081/getDetails
方法:发布
下面是json数据
{
"id": "1", "firstName": "xyz", "lastName": "abc", "address":"xy"
}
无论我传递了什么json数据,我都只想打印以进行处理.但在日志中显示有效载荷为空
whatever json data i passed , i just want to print for processing . but In logging it shows null payload
欢迎任何正确的解决方案
any correct solutions are welcome
推荐答案
您的代码绝对正确.正如Anirban指出的那样,您在调用该服务时可能会犯错.我尝试使用Chrome中的postman插件调用此服务,并选择具有原始XML的帖子,并且效果很好.请尝试与邮递员联系,并确认您是否仍然遇到相同的问题.
Your code is absolutely correct. As Anirban pointed out, you may be making mistake while invoking the service. I tried invoking this service using postman plugin in Chrome and selected post with raw XML and it worked fine. Please try with postman and confirm if you still have the same issue.
这篇关于ule将json数据发布到m端点url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!