Andreas,

Please find attached attachment.xml which I am using as inputstream to
create SOAPMessage. The MIME boundary in my previous code snippet may differ
since it is generated at runtime but this is the file generated by another
system. I am also sending you the code that generates the attached file.

SOAPMessage soapMsg = MessageFactory.newInstance().createMessage();
          //setting the namespace declaration.
          SOAPPart sp = soapMsg.getSOAPPart();
          SOAPEnvelope se = sp.getEnvelope();
          se.addNamespaceDeclaration("lw", "http://www.abc.com/xml/soap/";);
          soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING, "UTF-8");
          soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
          //setting the soap header.
          SOAPHeader soapHeader = soapMsg.getSOAPHeader();
          //setting the session id
          SOAPElement soapHeaderElement1 =
soapHeader.addChildElement("session", "lw", "http://www.abc.com/xml/soap/";);

soapHeaderElement1.addTextNode("8e0b383911e3942c87fda0be8ae1879b");
          //setting the transactionId
          SOAPElement soapHeaderElement2 =
soapHeader.addChildElement("transactionId", "lw", "
http://www.abc.com/xml/soap/";);
          soapHeaderElement2.addTextNode(String.valueOf("2"));
          //setting the serverId
          SOAPElement soapHeaderElement3 =
soapHeader.addChildElement("serverId", "lw", "http://www.abc.com/xml/soap/
");

soapHeaderElement3.addTextNode(String.valueOf("192.168.1.66_d7618e5711e394247a7da0be8ae08921"));
          SOAPBody soapBody = soapMsg.getSOAPBody();
          SOAPElement callElement = soapBody.addChildElement("call", "lw", "
http://www.abc.com/xml/soap/";);
          SOAPElement msgObjectId = callElement.addChildElement("objectId");
          msgObjectId.addTextNode("system");
          SOAPElement msgMethod = callElement.addChildElement("method");
          msgMethod.addTextNode("setRetVal");
          SOAPElement paramElement = callElement.addChildElement("param");
          SOAPElement valueElement = paramElement.addChildElement("value");
          valueElement.addTextNode("attachment.txt");
          DataHandler dh = new DataHandler(new FileDataSource("C:\\Documents
and Settings\\lab\\Desktop\\car.txt"));
          AttachmentPart ap = soapMsg.createAttachmentPart();
          ap.setContentId("attachment.txt");
          ap.setContent(dh.getContent(), dh.getContentType());
          soapMsg.addAttachmentPart(ap);

         OutputStream out = null;
    try {
      out = socket.getOutputStream();
      out.write(0x02);
      soapMsg.writeTo(out);
      out.write(0x03);
      out.flush();
    } catch (Exception e) {
      getLog().error("Exception sending the soap " + e, e);
    } finally {
      //   if (out == null) out.close();
    }


Chinmoy

On Thu, Dec 18, 2008 at 5:21 PM, Andreas Veithen
<[email protected]>wrote:

> Chinmoy,
>
> Can you also attach a sample message that you try to read with this code?
>
> Andreas
>
> On Thu, Dec 18, 2008 at 06:23, Chinmoy Chakraborty <[email protected]>
> wrote:
> > Andreas,
> >
> > Here is my code snippet.
> >
> > String contentType = multipart/related;
> >  boundary=MIMEBoundaryurn_uuid_D988AB74BC9802BDC21229577126047;
> >  type="text/xml";
> >  
> > start="<0.urn:uuid:[email protected]<0.urn%3auuid%[email protected]>
> >"
> >
> > MimeHeaders mimeHeaders = new MimeHeaders();
> > mimeHeaders.addHeader("Content-Type", contentType);
> > // Create the SOAP Message using mimeHeader and inputStream
> > MessageFactory mf = MessageFactory.newInstance();
> > SOAPMessage soapMsg = mf.createMessage(mimeHeaders, in);
> >
> > The inputstream is a SOAPMessage with attachments. Now the newly created
> > soapMsg in above code snippet does not contain any attachment parts.
> >
> > I am trying to get attachment parts in the following code snippet:
> >
> > List attachments = new ArrayList()
> > if (soapMsg.countAttachments() > 0) {
> >         Iterator itr = soapMsg.getAttachments();
> >         while (itr.hasNext()) {
> >           AttachmentPart att = (AttachmentPart) itr.next();
> >           DataHandler dh = att.getDataHandler();
> >           attachments.add(dh);
> >         }
> >       }
> >
> > The attachment list is always empty. I am using following jars:
> >
> > axiom-api-SNAPSHOT.jar (modified on 16th Dec, 2008)
> > axiom-dom-SNAPSHOT.jar (modified on 16th Dec, 2008)
> > axiom-impl-SNAPSHOT.jar (modified on 16th Dec, 2008)
> > axis2-saaj-SNAPSHOT.jar (modified on 12th Dec, 2008)
> > axis2-saaj-api-1.4.jar (modified on 4th April, 2008)
> >
> > Chinmoy
> >
> >
> >
> > On Thu, Dec 18, 2008 at 6:49 AM, Andreas Veithen <
> [email protected]>
> > wrote:
> >>
> >> Chinmoy,
> >>
> >> Can you post the code that demonstrates the problem?
> >>
> >> Andreas
> >>
> >> On Wed, Dec 17, 2008 at 13:40, Chinmoy Chakraborty <[email protected]>
> >> wrote:
> >> > Hi All,
> >> >
> >> > I am creating SOAPMessage from inputstream. The inputstream is SOAP
> with
> >> > attachments. But the attachmentParts becomes zero in the newly created
> >> > SOAPMessage though the content type is "multipart/related".
> >> >
> >> > Why it is not created attachments when I am creating SOAP from
> >> > inputstream
> >> > (with attachments)? I am using axiom-api-SNAPSHOT.jar,
> >> > axiom-dom-SNAPSHOT.jar, axiom-impl-SNAPSHOT.jar.(Axis2 1.4.1)
> >> >
> >> > Chinmoy
> >
> >
>
--MIMEBoundaryurn_uuid_E02F40DF7DD0D624331229583368110
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <0.urn:uuid:[email protected]>

<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:lw="http://www.labware.com/xml/soap/";><soapenv:Header><lw:session>8e0b383911e3942c87fda0be8ae1879b</lw:session><lw:transactionId>2</lw:transactionId><lw:serverId>192.168.1.66_d7618e5711e394247a7da0be8ae08921</lw:serverId></soapenv:Header><soapenv:Body><lw:call><objectId>system</objectId><method>setRetVal</method><param><value>attachment.txt</value></param></lw:call></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_E02F40DF7DD0D624331229583368110
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <attachment.txt>

MARUTI A-STAR
--------------

MARUTI A-STAR ZXI  413161.50  416386.16  
 
MARUTI A-STAR VXI  376161.51  379386.15 -- 421 ....vivek - 9883712024
 
MARUTI A-STAR LXI  347898.48  351123.12 -- 392



SPARK
------

Spark 1.0  ---  Rs.326579  -- 313 -- 9433473698 - pronoy chatterjee 

Spark 1.0 PS -- Rs.334940  -- 340 

Spark 1.0 LS -- Rs.353185  -- 352  

Spark 1.0 LT -- Rs.382086     

Spark 1.0 LT with Opt. pack(with airbag) -- Rs.427966


LOGAN
------

Logan 1.4 GL  475050  
 
Logan 1.4 GLE  495121  - 5.09,659 on road price
 
Logan 1.4 GLX  520826 - 5,36,000 on road  
 
Logan 1.6 GLX  558584  
 
Logan 1.6 GLS  587789  
 
Logan 1.6 GLS-ABS  607789
  

Indica Xeta
------------

GLG BS III -- Rs.333,801.00
GLS BS III -- Rs.308,605.00


MARUTI SWIFT
-------------

MARUTI SWIFT LXI (BHARAT STAGE III) 4,13,821 
MARUTI SWIFT VXI (BHARAT STAGE III) 4,45,039 
MARUTI SWIFT VXI (BHARAT STAGE III WITH ABS) 4,64,714 
MARUTI SWIFT LDI (BHARAT STAGE III) 4,78,962 
MARUTI SWIFT VDI (BHARAT STAGE III) 5,13,839 
MARUTI SWIFT ZXI (BHARAT STAGE III WITH ABS) 5,27,754 
MARUTI SWIFT VDI (BHARAT STAGE III WITH ABS) 5,32,816


HUNDAI GETZ
------------

GETZ GLE 1.1  394025 
GETZ GVS 1.1  426290 
GETZ GVS 1.1 175 tyre + Rear spoiler  433655 
GETZ GVS 1.3  443759 
GETZ GLS 1.3  464759 
GETZ GLX 1.3  498853 
GETZ GVS 1.5 CRDi  564741 


HUNDAI i-10
----------------

i-10 1.1 IRDE   

 
D-Lite (Solid) 337019 
D-Lite (Metallic) 340630 
Era (Solid) 372723 
Era (Metallic) 376335 
 

i-10 Kappa   

 
Magna (Solid) 402302 
Magna (Metallic) 405915 
Sportz GLS(Solid) 426969 
Sportz GLS(Metallic) 430580 
Magna AT(Solid) 445012 
Magna AT(Metallic) 448625 
Sportz AT GLS(Solid) 469679 
Sportz AT GLS(Metallic) 473291 
Asta GLS(Solid) 485778 
Asta GLS(Metallic) 489390 
Asta WS GLS(Solid) 501046 
Asta WS GLS(Metallic) 504658 
Asta AT WS GLS(Solid) 543813 
Asta AT WS GLS(Metallic) 547426 


SANTRO XING

372073 - 380 - GL
391970 - 400 - GLS

U.S DEY - 9748703201

------------------------------------------
SBI CAR LOAN - TICKET NO. - SBI-CL-102539 
------------------------------------------  

 







 
 

--MIMEBoundaryurn_uuid_E02F40DF7DD0D624331229583368110--

Reply via email to