如何在Mulesoft中嵌入CDATA
我试图在Mulesoft流中嵌入一个文本CDATA值,但不知道如何实现 我希望的输出(在HTTP请求正文中)是:如何在Mulesoft中嵌入CDATA,mule,mule-el,dataweave,Mule,Mule El,Dataweave,我试图在Mulesoft流中嵌入一个文本CDATA值,但不知道如何实现 我希望的输出(在HTTP请求正文中)是: ticketId 12345]]> 我的Dataweave转换如下所示: %dw 1.0 %output application/xml %namespace soap http://schemas.xmlsoap.org/soap/envelope --- { soap#Envelope @(version: "1.0") : {
ticketId 12345]]>
我的Dataweave转换如下所示:
%dw 1.0
%output application/xml
%namespace soap http://schemas.xmlsoap.org/soap/envelope
---
{
soap#Envelope @(version: "1.0") : {
soap#Header: {},
soap#Body: {
query: {
sXML: "<queryxml><entity>ticket</entity><query><condition><field>id<expression op=\"equals\">12345</expression></field></condition></query></queryxml>"
}
}
}
}
%dw 1.0
%输出应用程序/xml
%命名空间soaphttp://schemas.xmlsoap.org/soap/envelope
---
{
soap#信封@(版本:“1.0”):{
soap#头:{},
皂体:{
查询:{
sXML:“ticketid12345”
}
}
}
}
但是当我将此请求发送到requestb.in(检查内容)时,我可以看到它是这样发送的(关注sXML实体):
queryxml>entity>ticket/entity>query>condition>field>idexpression op=“equals”>12345/expression>/field>/condition>/query>/queryxml>
如何通过dataweave/MEL在其中获取文字CDATA值
谢谢。我想试试:
sXML: "<queryxml> .... </queryxml>" as :cdata
sXML:“…”as:cdata
有关更多信息,请参阅
handleInteractiveOrder:
write(vars.subm.soap#Envelope.soap#Body.cp#handleInteractiveOrder,“application/xml”)
作为CData
在mule 4中,我们可以这样做。我将XML保存在subm变量中
<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope" version="1.0">
<soap:Header/>
<soap:Body>
<query>
<sXML><queryxml><entity>ticket</entity><query><condition><field>id<expression op="equals">12345</expression></field></condition></query></queryxml></sXML>
</query>
</soap:Body>
</soap:Envelope>
sXML: "<queryxml> .... </queryxml>" as :cdata