mule - 为什么 Multipart/form-data 删除 Nill 以响应 Mule Dataweave
问题描述
<Date xsi:nil="true"/>
请在我的请求穿过数据编织时找到带有标签的请求,Multipart/form-data
它正在删除xsi:nil="true
我的场景中不期望的部分。我希望那是一样的。
此外,它正在删除不是预期情况的命名空间。如果我尝试ns xsi http://www.w3.org/2001/XMLSchema-instance
在第一个 dataweave 中声明。在响应根元素中,它带有前缀xsi:Locations
。我正在为此苦苦挣扎。
想要如下所述的响应,无论输入相同,都应该不改变。
使用writeNilOnNull=true
将 nill 放在我不想要的所有字段上,只想要日期。
任何人都可以帮助解决这个问题。谢谢你。
输入:
<Locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Location>
<Id>2</Id>
<CarId>78</CarId>
<Packages>1</Packages>
<Date xsi:nil="true"/>
</Location>
</Locations>
预期反应:
<Locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Location>
<Id>2</Id>
<CarId>78</CarId>
<Packages/>
<Date xsi:nil="true"/>
</Location>
</Locations>
流动:
<flow name="question" doc:id="8c836a85-9d0a-47a8-8e5a-f670b16f91eb" >
<http:listener doc:name="Listener" doc:id="52ffdb08-9587-4cb2-8232-9467e85ea0dc" config-ref="HTTP_Listener_config" path="/question"/>
<ee:transform doc:name="Transform Message" doc:id="da995adf-196b-4c7b-a265-874f059ed1bb" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
---
payload]]></ee:set-payload>
</ee:message>
</ee:transform>
<ee:transform doc:name="Transform Message" doc:id="75e5d876-855e-4d38-8468-3484c859f36e" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output multipart/form-data
---
{
"parts": {
"file": {
"headers": {
"Content-Disposition": {
"name": "file",
"filename": "",
"subtype": "form-data"
},
"Content-Type": "application/xml"
},
"content": payload
}
}
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
</mule>
解决方案
推荐阅读
- javascript - 循环 JSON 对象并将唯一的 JSON 项分配给给定的变量
- python-3.x - 为什么使用 Gaussian NB 分类器查找测试数据的分数时得到 0.0 的分数?
- gcc - CMAKE 中的 net-snmp 标志
- java - 我的类扩展 OutputStream 的 GZIPOutputStream 问题
- excel - 修剪不同工作表VBA中行和列中的单元格值
- c# - 使用 Selenium 在私有模式下打开 Internet Explorer
- android - 具有动态 applicationId 的 Firebase
- r - 如何将 30 年期间的每日数据转换为多元系列的每月数据?
- java - 接口方法在其他类中不可见
- css - 带有工具提示的简单表单标签