JSON 到 XML 转换的 Anypoint Studio 问题

Anypoint Studio problem with JSON into XML transformation

我正在尝试将 JSON 响应转换为 XML,然后使用负载调用 SOAP API。我成功地获得了 JSON 响应,但我无法将其转换为 XML。问题是数据必须采用以下格式:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <NumberToDollars xmlns="http://www.dataaccess.com/webservicesserver/">
      <dNum>47.92</dNum>
    </NumberToDollars>
  </soap:Body>
</soap:Envelope> 

但是当我将其用作 Transform Messages 模块的示例时,它会创建:

%dw 2.0
output application/xml
ns ns00 http://schemas.xmlsoap.org/soap/envelope/
ns ns01 http://www.dataaccess.com/webservicesserver/
---
{
    ns00#Envelope: {
        ns00#Body: {
            ns01#NumberToDollars: {
                ns01#dNum: payload.decimal
            }
        }
    }
}

当我使用 Logger 查看输出时,它是:

<?xml version='1.0' encoding='UTF-8'?>
<ns00:Envelope xmlns:ns00="http://schemas.xmlsoap.org/soap/envelope/">
  <ns00:Body>
    <ns01:NumberToDollars xmlns:ns01="http://www.dataaccess.com/webservicesserver/">
      <ns01:dNum>47.92</ns01:dNum>
    </ns01:NumberToDollars>
  </ns00:Body>
</ns00:Envelope>

我知道我可以手动更改它并且我设法让它看起来像这样:

%dw 2.0
output application/xml
ns soap http://schemas.xmlsoap.org/soap/envelope/
ns ns01 http://www.dataaccess.com/webservicesserver/
---
{
    soap#Envelope: {
        soap#Body: {
            NumberToDollars: {
                dNum: payload.decimal
            }
        }
    }
}

输出:

<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <NumberToDollars>
      <dNum>47.92</dNum>
    </NumberToDollars>
  </soap:Body>
</soap:Envelope>

但我不知道如何在没有名称空间的情况下获得 NumberToDollarsbe 并同时拥有 xmlns link(我怎样才能摆脱 ns00 并同时保留 link) .

我在 Mule 文档中检查了所有关于它的内容,但没有找到任何东西,请帮助。

一种方法是将 xmlns 定义为普通属性:

%dw 2.0
output application/xml
ns ns00 http://schemas.xmlsoap.org/soap/envelope/
ns ns01 http://www.dataaccess.com/webservicesserver/
---
{
    ns00#Envelope: {
        ns00#Body: {
            NumberToDollars @(xmlns: "http://www.dataaccess.com/webservicesserver/"): {
                dNum: payload.decimal
            }
        }
    }
}