Following problem is faced by my coworker and posting here:
All
SOAP request attachments has "Content-Transfer-Encoding" mime header.
In our web service, we have SOAP Message Handler. While trying to dump the SOAPMessage
contents, "Content-Transfer-Encoding" is missing. Below is the code snippet to
dump the SOAPMessage.
<snip>
public boolean handleMessage(SOAPMessageContext context) {
SOAPMessage soapMessage = context.getMessage();
soapMessage.writeTo(System.out);
<snip>
We even tried printing all the MIME headers in the attachment, but "Content-
Transfer-Encoding" is not present.
When we thought it was issue on the SAJJ side and opened
https://saaj.dev.java.net/issues/show_bug.cgi?id=52 defect.
After running snippet provided by Kumar, Nitin found SAJJ is able to parse this
header.
Request dump to webservice: STIRequest.dump
[BEGIN Outgoing STI Request: - 39]
--------=_Part_0_23063136.1145487152039
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-Id: <1234>
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns="http://www.openmobilealliance.org/schema/sti/v1_0" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
</env:Header>
<env:Body>
<TranscodingRequest>
<originatorID>MMSC.STI</originatorID>
<operationID>Video.Xcode</operationID>
<applicationType>MMS</applicationType>
<transcodingJob>
<jobID>videoJob</jobID>
<source>
<contentType>video/3gpp</contentType>
<location>cid:videoJob</location>
</source>
<target>
<transcodingParams>
<sizeLimit>800000</sizeLimit>
<video>
<contentType>video/x-ms-wmv</contentType>
<sizeLimit>800000</sizeLimit>
<videoVisual>
<codec>video/wmv3</codec>
<width>101</width>
<height>80</height>
<resizeDirective>AspectRatio</resizeDirective>
</videoVisual>
<videoAudio>
<codec>audio/wmav3</codec>
</videoAudio>
</video>
</transcodingParams>
</target>
</transcodingJob>
</TranscodingRequest>
</env:Body>
</env:Envelope>
--------=_Part_0_23063136.1145487152039
Content-Type: video/3gpp
Content-Transfer-Encoding: base64
Content-Id: <videoJob>
AAAAHGZ0eXAzZ3A0AAACAGlzb21pc28yM2dwNAAAAAhmcmVlAAe3kW1kYXQAAIACDAMmICAgIf//
...<Data stripped due to large size>
Fg==
--------=_Part_0_23063136.1145487152039--
==========================================
soapMessage dump: soapMessage.writeTo.dump
23:26:33 DEBUG: soap.AttachmentsHandler <handleInboundMessage> | DUMPPPPPPPPPPPPPPPPPPPPPPPPPPPP
------=_Part_2_1457099383.1273472793081
Content-Type: text/xml; charset=utf-8
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.openmobilealliance.org/schema/sti/v1_0"><env:Header/><env:Body><TranscodingRequest xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<originatorID>MMSC.STI</originatorID>
<operationID>Video.Xcode</operationID>
<applicationType>MMS</applicationType>
<transcodingJob>
<jobID>videoJob</jobID>
<source>
<contentType>video/3gpp</contentType>
<location>cid:videoJob</location>
</source>
<target>
<transcodingParams>
<sizeLimit>800000</sizeLimit>
<video>
<contentType>video/x-ms-wmv</contentType>
<sizeLimit>800000</sizeLimit>
<videoVisual>
<codec>video/wmv3</codec>
<width>101</width>
<height>80</height>
<resizeDirective>AspectRatio</resizeDirective>
</videoVisual>
<videoAudio>
<codec>audio/wmav3</codec>
</videoAudio>
</video>
</transcodingParams>
</target>
</transcodingJob>
</TranscodingRequest></env:Body></env:Envelope>
------=_Part_2_1457099383.1273472793081
Content-Type: video/3gpp
Content-ID: <videoJob>
AAAAHGZ0eXAzZ3A0AAACAGlzb21pc28yM2dwNAAAAAhmcmVlAAe3kW1kYXQAAIACDAMmICAgIf//
...<Data stripped due to large size>
Fg==
------=_Part_2_1457099383.1273472793081--
========================================================
Platform details:
JAX-WS version: JAX-WS RI 2.2
Container: apache-tomcat-5.5.28
OS: Linux msg-lnx7 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64
x86_64 x86_64 GNU/Linux
================================================
Below is the blog extract which mentions limitation of MimePull parser.
"One thought was to make the use of MimePull the default in SAAJ RI, however i
heard from the MimePull project lead that one thing it does not handle right now
is any kind of non-default Content-Transfer-Encoding (such as base64 for
example)."
Blog link:
http://weblogs.java.net/blog/kumarjayanti/archive/2009/12/10/summary-
proprietary-features-saaj-ri-134