Java(1.6)中是否有任何方法可以检测SOAP消息是否为MTOM,或者是否需要为此创建方法来检查消息是否包含多个部分?
基于SOAP 1.2规范
确定HTTP SOAP传输优化功能是否为 通过检查application / xop + xml媒体类型的存在来使用
但是我的MTOM消息中没有看到它,在测试(最小化)情况下看起来像
------=_Part_0_591998098.1543337064443
Content-Type: application/soap+xml; charset=utf-8
<soapenv:Envelope>some SOAP message</soapenv:Envelope>
------=_Part_0_591998098.1543337064443
Content-Type: null
Content-ID: <1.4a159e8e@apache.org>
Content-Transfer-Encoding: binary
Content-Type: text/html
<?xml version="1.0" encoding="us-ascii"?><html><head><title>testlf</title></head><body><b>Message Type: </b>Direct<br /><b>Subject: </b>testlf<br /><hr /></body></html>
------=_Part_0_591998098.1543337064443
Content-Type: application/octet-stream
Content-ID: <http://tempuri.org/1/635742060149828871>
Content-Transfer-Encoding: binary
<?xml version='1.0'?><?xml-stylesheet type='text/xsl'?>Here is PDF
------=_Part_0_591998098.1543337064443--
答案 0 :(得分:0)
我结束了
private boolean isMTOM(SOAPMessage msg) throws SOAPException, IOException
{
boolean isMTOM = false;
MimeHeaders headers = msg.getMimeHeaders();
String[] contentType = headers.getHeader("Content-Type");
if(contentType[0].toLowerCase().contains("multipart/related") && (contentType[0].toLowerCase().contains("application/soap+xml") || contentType[0].toLowerCase().contains("application/xop+xml"))) {
isMTOM = true;
}
return isMTOM;
}