Attachment is not encoded

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Attachment is not encoded

Udhayakumar
Hi,

We are sending a transaction to our customers using SOAP web service.

Our enviornment:

   Container : None (Component is running as stand alone)
    Axis version : 1.6.2

Requirment:

  If the transaction size is small, we need to send the content as part of Body.
  If the transaction is huge, need to send the content as an attachment.

Code snippet:

final ServiceClient sender = new ServiceClient();
final Options options = new Options();
options.setTo(endpointRef);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE);
sender.setOptions(options);

final OMFactory omFactory = OMAbstractFactory.getOMFactory();
.
.
.
DataHandler dataHandler = new DataHandler(new FileDataSource(new File("C://KB_9.9.xml")));
OMText omText = omFactory.createOMText(dataHandler, true);

final OMElement inputData = omFactory.createOMElement("inputData",null);
inputData.addChild(omText);

method.addChild(inputData);
sender.fireAndForget(omElement);


Our issue:
It is working fine and the data reached successfuly. But the issue is attachment is not encoded. It is displaying the content of the file as it is. My question is do we need to enable any of the property of axis to encode the attachment content or we need to manually perform the Base64 Encoding.


Sample Output:

--MIMEBoundary_5e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.d5d9e693c8e32f0069b7cbb392d60e7f8b08366c7cb4384d@apache.org>

<?xml version='1.0' encoding='UTF-8'?>
...
<data>
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.7e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3@apache.org">xop:Include></data>


--MIMEBoundary_5e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <1.7e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3@apache.org>

My test file.....

--MIMEBoundary_5e6b57717e6fc299242f9cc2ec3ab3d6cd5ef851033370e3--


Can you please help me to resolve this issue

Regards
Udhaya
Loading...