【问题标题】:Mule ESB - overriding Media-Type of HTTP RequestMule ESB - 覆盖 HTTP 请求的媒体类型
【发布时间】:2018-05-28 16:51:44
【问题描述】:

我正在尝试使用标准 mule HTTP 请求发送 SOAP 信封,但在设置出站请求的 Media-Type 时遇到问题。 Web 服务需要“application/soap+xml”,但在 POST 请求中设置 'Content-Type: application/soap+xml' 标头或将 mime-type 设置为有效负载似乎不起作用。我不断收到错误 415 - 不支持的媒体类型。有谁知道我能做些什么来解决这个问题?到目前为止我的 XML 代码(我已经更改了名称和地址,想法保持不变):

     <flow name="get-report">
    <http:listener config-ref="asdf-httpListenerConfig" path="/" doc:name="HTTP"/>

    <custom-transformer encoding="UTF-8" mimeType="application/soap+xml" class="Authorization" doc:name="Java"/>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>

    <http:request config-ref="HTTP_Request_Configuration" path="path.svc" method="POST" doc:name="HTTP">
        <http:request-builder>
            <http:header headerName="Content-Type" value="application/soap+xml"/>
            <http:header headerName="action" value="someAction"/>
            <http:header headerName="host" value="someHost"/>
        </http:request-builder>
    </http:request>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>

“授权”转换器并不真正相关,现在我只是对整个信封进行硬编码并返回它。 此外,通过具有相同地址、内容类型和媒体类型的soapUI 发布信封也可以正常工作。

【问题讨论】:

    标签: rest api http mule esb


    【解决方案1】:

    在 http:request 中设置标头绝对应该设置 Content-Type 标头,所以我建议这不是问题。虽然它依赖于 API 实现,但 415 Unsupported Media Type 可能是由请求 Content-Type, Content-Encoding or by inspecting the data directly 引起的。也许这可能是由 XML 结构引起的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-03
      • 2012-09-16
      • 1970-01-01
      • 1970-01-01
      • 2015-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多