【发布时间】:2018-09-05 18:08:54
【问题描述】:
当我们开始将 Mulesoft 作为我们公司的试点实施时,我们注意到 mulesoft 会在看似随机的时刻继承系统代码页 (windows-1252)。尽管设置了 Anypoint studio (7.2.0) 首选项,并且运行时 (4.2.1 EE) 默认为 UTF-8。因此,传出连接器(和默认 http 连接器)将以这种编码发送它们的 http 请求。我们编写的任何 API 都会出现以下错误:
Message : HTTP PUT on resource 'https://mocksvc-proxy.anypoint.mulesoft.com:443/exchange/*********/1.0.2/subscription' failed: media type application/json; charset=windows-1252 not supported (415).
我们发现解决这个问题的方法是在连接器之前设置消息转换的编码,以将其强制为 UTF-8,如下所示:
<ee:transform doc:name="Transform Message" doc:id="-redacted-">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json encoding="UTF-8"
---
{
"applicatie": "-redacted-",
"clientid": vars."-redacted-" as Number
}]]></ee:set-payload>
</ee:message>
</ee:transform>
但是,自从 anypoint studio 7.2.1 以来,此修复程序不再有效。 我找不到我们所做的任何更改,所有设置仍设置为 UTF-8。
Project setting set to UTF-8 image
有谁知道我们可以尝试强制编码或让我们构建的 api 接受 windows-1252 的方法? (如果可能的话,这是可以接受的,但不是最好的)
或者您认为这是我们需要向 mulesoft 报告的错误吗?
此问题出现在 Mule Standalone EE 版本:4.1.2 版本:41de9970 上 Windows 服务器 2016 数据中心。 Anypoint studio 嵌入式 Mule 4.1.2 在 Windows 7 上。
【问题讨论】: