WSO2 ESB 有效负载工厂创建无效的 SOAP 信封 [英] WSO2 ESB Payload Factory creates invalid SOAP envelope

查看:34
本文介绍了WSO2 ESB 有效负载工厂创建无效的 SOAP 信封的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 REST 请求转换为 WSO2 的 ESB 中的 SOAP 请求.因此,我在 ESB 中创建了一个提供 REST 端点的 API.在这个 API 中,每个资源都有一个 In-Sequence,其中包含一个 Payload Factory Mediator.此介体将 REST 请求转换为 SOAP 消息.然后将 SOAP 消息发送到我之前定义的自定义 ESB 代理.

I am trying to translate a REST request to a SOAP request in WSO2's ESB. Therefore I created an API in the ESB that offers the REST endpoint. In this API each resource has an In-Sequence that contains a Payload Factory Mediator. This mediator translates the REST request to a SOAP message. The SOAP message is then send to a custom ESB proxy that I had defined previously.

问题在于:当我发送 REST 请求时,请求被处理并转换为 SOAP,但响应 HTML 状态代码为 500.因此,我激活了 ESB 中的 SOAP Message Tracer 以检查哪些消息是进入并检查由 Payload Factory Mediator 创建的消息的外观.

Here is the issue: When I send a REST request the request gets processed and translated to SOAP, but the response HTML status code is 500. As a consequence I activated the SOAP Message Tracer in the ESB to check, what messages are coming in and to check how the messages look like that are created by the Payload Factory Mediator.

Payload Factory 生成的 SOAP 消息看起来肯定是错误的,如下所示:

The resulting SOAP message of the Payload Factory looks definitely wrong, like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
     <soapenv:Envelope>
        <soapenv:Body>
           <mms:getCarData xmlns:mms="mms.cardiag"/>
        </soapenv:Body>
     </soapenv:Envelope>
  </soapenv:Body>

如您所见,消息中创建了第二个 + 正文.我无法弄清楚为什么会发生这种情况,关键是因为我遵循了 WSO2 文档的示例 800 非常接近.

As you can easily see, there is a second <soapenv:Envelope> + body created in the message. I can't figure out why this happens, crucially since I followed the Example 800 of the WSO2 documentation very closely.

我也在我的 REST API 中提供了资源的实现,因此您可以检查我的 Payload Factory Mediator 配置.我确定我遗漏了一些重要的东西,但很遗憾,我无法弄清楚是什么.

I provide the implementation of a resource in my REST API as well, so you can check my configuration of the Payload Factory Mediator. I am sure I am missing something important, but I cannot figure out what, unfortunately.

<resource methods="GET" uri-template="/cardata">
  <inSequence>
     <payloadFactory media-type="xml">
        <format>
           <mms:getCarData xmlns:mms="mms.cardiag"/>
        </format>
        <args/>
     </payloadFactory>
     <log level="full" category="TRACE"/>
     <send>
        <endpoint>
           <address uri="http://wso2-1:8280/services/TestProxy" format="soap11"/>
        </endpoint>
     </send>
  </inSequence>
  <outSequence>
     <send/>
  </outSequence>

感谢您的帮助!

推荐答案

假设格式是 text/xml,你应该使用 header 中介来设置 SOAP Action.如果没有SOAP Action,可以设置一个空白:

Assuming format is text/xml, you should set the SOAP Action using header mediator. If there is no SOAP Action, you can set a blank one :

<header name="Action" value="&quot;&quot;"/>

这篇关于WSO2 ESB 有效负载工厂创建无效的 SOAP 信封的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆