Reputation: 12159
I am sure this is just pilot error, but cannot find a solution. Have a jax-ws web service with a soap payload operation that includes an attachment. Here is a snippet of the schema doc. This is the type defined:
<xs:complexType name="BinaryAttachmentType">
<xs:simpleContent>
<xs:restriction base="xmime:base64Binary">
<xs:attribute ref="xmime:contentType" use="required" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
Embedded in this element definition:
<xs:element name="Contact">
<xs:complexType>
<xs:sequence>
<!-- removed other elements -->
<xs:element name="Attachment" type="BinaryAttachmentType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element
Using soapUI, SOAP looks like:
<hsn:Contact>
<!-- other elements -->
<hsn:Attachment xm:contentType="image/jpeg">cid:323665198529</hsn:Attachment>
</hsn:Contact>
Attached file in soapUI: When I look at http from log:
http Header:
"Content-Type: multipart/related; type="text/xml"; start="<[email protected]>"; boundary="----=_Part_15_23791896.1485382707426""
"SOAPAction: "http://hsn.us.banner.hsntech.com/Level1Request""
"MIME-Version: 1.0"
"Content-Length: 104164"
"Host: localhost:7001"
"User-Agent: Apache-HttpClient/4.1.1 (java 1.5)"
"------=_Part_15_23791896.1485382707426"
"Content-Type: text/xml; charset=UTF-8"
"Content-Transfer-Encoding: 8bit"
"Content-ID: <[email protected]>"
in SOAP body, see attachment element with base64-encoded file:
<hsn:AttachmentFileName>test1.jpg</hsn:AttachmentFileName>
<hsn:Attachment xm:contentType="image/jpeg">/9j/4AAQSkZJRgABAQEAYABgAAD .. rest of base64 encoding
then after SOAP message, encoded attachment again:
------=_Part_15_23791896.1485382707426
Content-Type: image/jpeg;
name=Foo.jpg
Content-Transfer-Encoding: binary
Content-ID: <Foo.jpg>
Content-Disposition: attachment; name=Foo.jpg; filename=Foo.jpg
(... encoded attachment again )
[0xff][0xd8][0xff][0xe0][0x0][0x10]JFIF[0x0][0x1][0x1][0x1][0x0]`[0x0]`[0x0][0x0][0xff][0xdb][0x0]C[0x0][\n]
So, why the file encoded twice in the request? Thanks.
Upvotes: 0
Views: 837
Reputation: 2349
Check that Enable MTOM is set to True in the Request Properties:
Upvotes: 1