如何自定义 JAXB MTOM Marshaller

问题描述

Guying 我正在尝试自定义 JAXB Marshaller,使 mtom 启用为 true。

下面是 jAXB Marshaller Bean

@Bean
public Jaxb2Marshaller getLGMarshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setMtomEnabled(true);
    marshaller.setcontextpath("pk.herman.wsdl");
    return marshaller;
}

上述编组器的当前输出

<ns2:Attachment>
    <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1b295245-200b-4306-a245-5d3248c3b7c0%40herman.pk"/>

预期输出

<ns2:Attachment>cid:1b295245-200b-4306-a245-5d3248c3b7c0%40herman.pk</ns2:Attachment>
</ns2:Attachment>

这就是我使用 javax.activation.DataHandler 附加 mtom 的方式

new DataHandler(re.getLaglFileContent().getBytes(),MediaType.APPLICATION_OCTET_STREAM_VALUE));

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)