【发布时间】:2015-04-22 01:46:09
【问题描述】:
骡码
<flow name="getDetails">
<http:inbound-endpoint doc:description="This endpoint receives an HTTP message." doc:name="HTTP" exchange-pattern="request-response" host="localhost" port="8081" path="getDetails"/>
<json:xml-to-json-transformer doc:name="XML to JSON" mimeType="text/json" ignoreBadInput="true"/>
<logger message="xml to json output #[message.payload]" level="INFO" doc:name="Logger"/>
<logger message=" custom header username ... #[message.outboundProperties.get('http.headers.username')]" level="INFO" />
<logger message=" custom header username ... #[message.inboundProperties.get('http.headers.username')]" level="INFO" />
<http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:8081/callReservation" method="POST" contentType="application/json" doc:name="HTTP"/>
</flow>
这里我将输入作为正文中的员工 xml
并在标题中 我在邮递员休息客户端中提供 username=user1 password=pwd1
<?xml version="1.0" encoding="UTF-8"?>
<employee>
<name>abc</name>
<address>add1</address>
<phone>1212</phone>
</employee>
我收到如下错误
com.ctc.wstx.exc.WstxUnexpectedCharException:序言中出现意外字符“{”(代码 123);预期'
使用 header 和 xmlto json 转换对我来说是强制性的。 谁能帮帮我
【问题讨论】:
-
你为什么使用 XML 到 JSON ?您需要发送到出站的数据是什么??
-
XML 到 JSON 的转换是我的要求。
-
您要为外部出站服务放置什么有效负载.. 是 JSON 还是 XML?
-
org.mule.api.processor.LoggerMessageProcessor:自定义标头用户名 ... null 但我希望显示标头名称。我可以做的那个 xml json 转换。 .主要使用标题用户名和密码。显示在日志消息中。它显示为空。
标签: mule