Results 1 to 2 of 2
Thread: how to get mime boundary
- 10-20-2010, 04:50 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 1
- Rep Power
- 0
how to get mime boundary
i also having the same issue!!
i am using axis 1.2 and my code as below:
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
//Create objects for the message parts
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
//Populate the body
//Create the main element and namespace
String reconRep = "40637781|44084597|110|20091019141048|121|||\n " +
"77371568|44084597|120|20091019141050|121|||\n " +
"66432343|44084597|130|20091019141059|121|41111111 11111111||\n" +
"TOT. REC : 3 TOT. AMT : 360";
//Populate the body
//Create the main element and namespace
SOAPBodyElement ops = body.addBodyElement(envelope.createName("ReconRepo rt" ,"ns1","http://paymentGateway.celcom.com"));
SOAPElement rrtelement1 = ops.addChildElement("ns1:login").addTextNode("eonb ");
SOAPElement rrtelement2 = ops.addChildElement("ns1:pass").addTextNode("eonb" );
SOAPElement rrtelement3 = ops.addChildElement("ns1:filename").addTextNode("2 0101013.txt");
SOAPElement rrtelement4 = ops.addChildElement("ns1:desc").addTextNode("Recon ciliation report");
SOAPElement rrtelement5 = ops.addChildElement(envelope.createName("attachmen t" ,"ns1","http://www.w3.org/2005/05/xmlmime"));
rrtelement5.addAttribute(envelope.createName("cont entType","ns2","text/plain"),"text/plain");
rrtelement5 = ops.addChildElement("xop","");
SOAPElement att = rrtelement5.addChildElement(envelope.createName("I nclude" ,"xop","http://www.w3.org/2004/08/xop/include"));
att.addAttribute(envelope.createName("href"), "cid:" + "1.urn:uuid:363C4A73A8CE5D13101255934202526@apache .org");
AttachmentPart attachment = message.createAttachmentPart();
attachment.addMimeHeader("Content-Type","Multipart/Related; boundary=MIME_boundary; \n" +
" type=\"application/xop+xml\"; start=\"1.urn:uuid:363C4A73A8CE5D13101255934202526 @apache.org\"");
attachment.setContent(reconRep,"text/plain");
attachment.setContentId("1.urn:uuid:363C4A73A8CE5D 13101255934202526@apache.org");
message.addAttachmentPart(attachment);
//Save the message
message.saveChanges();
The result is :
------=_Part_0_26083064.1287029047655
Content-Type: text/xml; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-ID: __WLS__1287029047693__SOAP__
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Body>
<ns1:ReconReport xmlns:ns1="http://paymentGateway.celcom.com">
<ns1:login>eonb</ns1:login>
<ns1:pass>eonb</ns1:pass>
<ns1:filename>20101013.txt</ns1:filename>
<ns1:desc>Reconciliation report</ns1:desc>
<ns1:attachment ns1:xmlns="http://www.w3.org/2005/05/xmlmime" ns1:contentType="text/plain">
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.urn:uuid:363C4A73A8CE5D131012559342025 26@apache.org">
</xop:Include>
</ns1:attachment>
</ns1:ReconReport>
</env:Body>
</env:Envelope>
------=_Part_0_26083064.1287029047655
Content-Type: text/plain
Content-Id: 1.urn:uuid:363C4A73A8CE5D13101255934202526@apache. org
40637781|44084597|110|20091019141048|121|||
77371568|44084597|120|20091019141050|121|||
66432343|44084597|130|20091019141059|121|411111111 1111111||
TOT. REC : 3 TOT. AMT : 360
------=_Part_0_26083064.1287029047655--
how to get mime boundary
-
Hijack post moved from old thread: 7271-problem-when-generating-mime-header-soap-packet-using-saaj.html
Poster, please do not hijack another's thread.
Similar Threads
-
boundary, problem with sending several files as attachment
By anurit in forum Java AppletsReplies: 1Last Post: 03-05-2010, 02:05 AM -
Creating a boundary line in java
By Riz in forum New To JavaReplies: 2Last Post: 09-03-2009, 12:54 AM -
getting the default browser+MIME data
By waleed_cs2000 in forum NetworkingReplies: 1Last Post: 04-08-2008, 01:31 PM -
Mime type of a file from web
By Java Tip in forum Java TipReplies: 0Last Post: 03-03-2008, 05:20 PM -
Mime type of a file
By Java Tip in forum Java TipReplies: 0Last Post: 03-03-2008, 05:18 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks