Hello,
I want to use WSDL2Java generated client to pass on huge files as
attachment. In the swa example delivered with Axis, the attachment type
is demonstrated as multipart/mixed.
<input>
<mime:multipartRelated>
<mime:part>
<soap:body use="literal" parts="body"/>
</mime:part>
<mime:part>
<mime:content part="document" type="multipart/mixed"/>
</mime:part>
</mime:multipartRelated>
</input>
Axis uses data type javax.mail.internet.MimeMultipart for this, and the
SOAP request generated has the second part as another multipart MIME
message. This is consistent with the documentation also. The resulting
SOAP request looks as below:
POST ***
Content-Type: multipart/related; type="text/xml";
start="<0AFF17E8EDA2B4E9DB4E664732D30622>";
boundary="----=_Part_1_31538695.1131431311659"
Accept: application/soap+xml, application/dime, multipart/related,
text/*
User-Agent: Axis/1.3
Host: ***
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ***
Content-Length: 4138
------=_Part_1_31538695.1131431311659
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <0AFF17E8EDA2B4E9DB4E664732D30622>
<?xml version="1.0"
encoding="UTF-8"?><soapenv:Envelope>...</soapenv:Envelope>
------=_Part_1_31538695.1131431311659
Content-Type: multipart/mixed;
boundary="----=_Part_0_6147782.1131431310417"
Content-Transfer-Encoding: binary
Content-Id: <49660838630C142BAE3092EF2A061D8F>
------=_Part_0_6147782.1131431310417
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
<?xml version = "1.0"?>
<AttachmentEnvelope> ...
</AttachmentEnvelope>
------=_Part_0_6147782.1131431310417--
------=_Part_1_31538695.1131431311659--
Note that there are two boundaries, one for the whole payload, and the
second for attachment. But I want to send xml files as attachments, and
don't want to use multipart/mixed attachments. I know I will only be
handling one attachment, and want the attachment to be just xml. I want
to get rid of second boundary, and want just the plain xml to be the
attachment.
I do get the desired result when I change the WSDL to declare
attachment type as "application/octetstream" instead of
"multipart/mixed". Axis uses data type
org.apache.axis.attachments.OctetStream for this, and I get the request
the way I want. But the drawback here is that I tried only with small
xml files. I expect the attachment files to be as big as 30-50 Mb, and
getting it all in byte[] is not feasible. I want file streaming classes
that produces with xml file as attachment.
How should I proceed? What changes should I be making to my wsdl, and
which all classes should I be looking at?
Thanks,
Vineesh
___________________________________________________
Try the New Netscape Mail Today!
Virtually Spam-Free | More Storage | Import Your Contact List
http://mail.netscape.com