【问题标题】:Mule ESB returns my XML as <string>xml</string> instead of proper XMLMule ESB 将我的 XML 返回为 <string>xml</string> 而不是正确的 XML
【发布时间】:2014-04-24 17:44:46
【问题描述】:

当使用我的 Web 浏览器作为客户端进行测试时,我的 Mule 流程返回了我预期的 XML 结果,它是一个类似 XML 的长字符串,由“string”标签包围,而不是格式正确的 XML,没有“@987654324” @”标签。即我得到

  <string><?xml version="1.0" encoding="utf-8"?><scan><patient_fname>John</patient_fname><scan_id>41fc14e761024d65eb3f31e6f6ff9abb</scan_id><patient_lname>Smith</patient_lname><crtransform>0.3802383 -0.2290233 -0.8960843 68.6041674 0.8808550 0.3850588 0.2753618 -10.1133584 0.2819809 -0.8940235 0.3481504 23.7410466 0.0000000 0.0000000 0.0000000 1.0000000</crtransform><datetime>1393790925155012</datetime><cotransform></cotransform><ormco_id>1111121</ormco_id><patient_gender>M</patient_gender><uploads_complete>True</uploads_complete><doctor_email_id>abcde</doctor_email_id><patient_dob>1986-06-27</patient_dob></scan></string>

来自 Mule,而不是我需要的(绕过 Mule 并直接在 RESTful 网络服务上请求时获得:

<scan>
  <patient_fname>John</patient_fname
  <scan_id>41fc14e761024d65eb3f31e6f6ff9abb</scan_id
  <patient_lname>Smith</patient_lname>
  <crtransform>0.3802383 -0.2290233 -0.8960843 68.6041674 0.8808550 0.3850588 0.2753618 -10.1133584 0.2819809 -0.8940235 0.3481504 23.7410466 0.0000000 0.0000000 0.0000000 1.0000000</crtransform>
  <datetime>1393790925155012</datetime>
  <cotransform/>
  <ormco_id>1111121</ormco_id>
  <patient_gender>M</patient_gender>
  <uploads_complete>True</uploads_complete>
  <doctor_email_id>abcde</doctor_email_id>
  <patient_dob>1986-06-27</patient_dob>
</scan>

这是 Mule 流程的相关部分:

...
<choice doc:name="Choice">
        <when expression="#[message.inboundProperties['format'] == 'xml']">
            <mulexml:object-to-xml-transformer mimeType="application/xml" doc:name="Object to XML"/>
            <set-property propertyName="Content-Type" value="text/xml" doc:name="text/xml content-type"/>
        </when>
        <otherwise>
            <json:object-to-json-transformer doc:name="Object to JSON"/>
        </otherwise>
    </choice>

任何建议将不胜感激。

【问题讨论】:

    标签: xml web service mule


    【解决方案1】:

    在某处XML 使用&lt;object-to-string-transformer&gt;component 或其他位置转换为String

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多