我在使用 ApiKit for SOAP 将传出数据映射到 SOAP 响应时遇到问题。
响应应该是这样的:
<Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<getPricesResponse xmlns:ns4="http://sax.xml.org/xsd" xmlns:ns3="http://sql.java/xsd" xmlns:ns2="http://some.soap.service.pl" xmlns="http://some.soap.service.pl/xsd">
<return>
<dealerNoNabywca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<dealerNoOdbiorca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<errorType>
VIN_NOT_FOUND
</errorType>
<price1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<price2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<price3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<resultStatus>
0
</resultStatus>
</return>
</getPricesResponse>
</Body>
</Envelope>
但这就是响应的样子:
<Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<getPricesResponse xmlns:ns0="http://some.soap.service.pl">
<return>
<dealerNoNabywca xmlns:ns01="http://some.soap.service.pl/xsd" />
<dealerNoOdbiorca xmlns:ns01="http://some.soap.service.pl/xsd" />
<errorType xmlns:ns01="http://some.soap.service.pl/xsd">
VIN_NOT_FOUND
</errorType>
<price1 xmlns:ns01="http://some.soap.service.pl/xsd" />
<price2 xmlns:ns01="http://some.soap.service.pl/xsd" />
<price3 xmlns:ns01="http://some.soap.service.pl/xsd" />
<resultStatus xmlns:ns01="http://some.soap.service.pl/xsd">
0
</resultStatus>
</return>
</getPricesResponse>
</Body>
</Envelope>
这是 DataWeave 转换器:
output application/java
ns ns0 http://some.soap.service.pl
ns ns01 http://some.soap.service.pl/xsd
---
{
body: {
ns0#getPricesResponse: {
ns0#return: {
ns01#dealerNoNabywca: payload.return.dealerNoNabywca,
ns01#dealerNoOdbiorca: payload.return.dealerNoOdbiorca,
ns01#errorType: payload.return.errorType,
ns01#price1: payload.return.price1,
ns01#price2: payload.return.price2,
ns01#price3: payload.return.price3,
ns01#resultStatus: payload.return.resultStatus
}
}
} write "application/xml"
}
据我了解,XML 命名空间存在某种问题,但我不知道如何使用正确的命名空间使响应看起来像它应该的样子......有没有办法让我当前的响应看起来像预期的响应?