You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Chinmoy Chakraborty <cc...@gmail.com> on 2008/12/01 09:52:49 UTC

SOAPMessage with attachment problem

Hi All,

I am creating a SOAP message using axis2 soap-api and soap-impl. First I am
creating the SOAPPart and then I am adding the attachmentpart.

Now, when I do soapMessage.writeTo(OuputStream out), it only writes the soap
envelop and not the MIME message. Could somebody please clarify why it is
not writing the MIME message. Following is my code snippet....

      soapMsg = MessageFactory.newInstance().createMessage();
      //setting the namespace declaration.
      SOAPPart sp = soapMsg.getSOAPPart();
      SOAPEnvelope se = sp.getEnvelope();
      soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING, DEFAULT_ENCODING);
      soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");

     se.addChildElemet().......

     then I am adding the attachments...like
     addAttachments(attachmentList);


private void addAttachments(List attachmentList) throws SOAPException,
IOException {
      if (attachmentList != null && attachmentList.size() > 0) {
          Iterator attachmentit = attachmentList.iterator();
          while (attachmentit.hasNext()) {
              DataHandler dh = (DataHandler) attachmentit.next();
              AttachmentPart ap = soapMsg.createAttachmentPart();
              ap.setContentId(dh.getName());
              Object content = dh.getContent();
              ap.setContent(dh.getContent(), dh.getContentType());
              soapMsg.addAttachmentPart(ap);
          }
      }
  }


Thanks,
Chinmoy

Re: SOAPMessage with attachment problem

Posted by Chinmoy Chakraborty <cc...@gmail.com>.
Andreas,

What does it mean by "Constants.Configuration.MTOM_THRESHOLD"??

Chinmoy

On Wed, Dec 3, 2008 at 3:29 AM, Andreas Veithen
<an...@gmail.com>wrote:

> Chinmoy,
>
> The error indeed indicates that you also need to upgrade to a newer
> AXIOM version. Snapshots are available from [1]. For the other issue:
> the next Axis2 release will indeed require Java 1.5. If upgrading to
> that Java version is not an option for you, please have a look at
> retrotranslator [2].
>
> Andreas
>
> [1]
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/ws/commons/axiom/
> [2] http://retrotranslator.sourceforge.net/
>
> On Tue, Dec 2, 2008 at 06:34, Chinmoy Chakraborty <cc...@gmail.com>
> wrote:
> > Andreas,
> >
> > I have downloaded the axis2-saaj-SNAPSHOT.jar from the [2] link but I am
> > getting following error:
> >
> > Caused by: java.lang.NoSuchMethodError:
> >
> org.apache.axiom.om.impl.MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(Ljavax/activation/DataHandler;Ljava/lang/String;Ljava/io/OutputStream;Ljava/util/Map;Lorg/apache/axiom/om/OMOutputFormat;)V
> >  at
> org.apache.axis2.saaj.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:327)
> >
> > I guess I need to download latest axiom code also. Could you please tell
> me
> > the url? One more thing I noticed latest saaj-impl code has been compiled
> in
> > jdk 1.5 and as I have been running jdk1.4 it was giving version error. Do
> > you plan to compile this in jdk 1.4 also?
> >
> > Chinmoy
> >
> >
> >
> >
> >
> >
> > On Mon, Dec 1, 2008 at 5:45 PM, Andreas Veithen <
> andreas.veithen@gmail.com>
> > wrote:
> >>
> >> Chinmoy,
> >>
> >> You can either build it from sources (using the Subversion repository
> >> at [1]) or wait for the next build and pick up the JAR at [2]. I don't
> >> know the exact build schedule, but a new build should be available
> >> within 24 hrs. Also, be aware that axis2-saaj-api no longer exists,
> >> but has been moved to Geronimo.
> >>
> >> Andreas
> >>
> >> [1] http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/
> >> [2]
> >>
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/axis2/axis2-saaj/SNAPSHOT/
> >>
> >>
> >> On Mon, Dec 1, 2008 at 12:48, Chinmoy Chakraborty <cc...@gmail.com>
> >> wrote:
> >> > Hi Andreas,
> >> >
> >> > Thanks for reply. How do I get the fixed version? From where do I get
> >> > latest
> >> > jars?
> >> >
> >> > Chinmoy
> >> >
> >> > On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen
> >> > <an...@gmail.com>
> >> > wrote:
> >> >>
> >> >> Chinmoy,
> >> >>
> >> >> It is not writing MIME messages because the writeTo method was not
> >> >> implemented correctly. This should now be fixed in trunk.
> >> >>
> >> >> Andreas
> >> >>
> >> >> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <cc...@gmail.com>
> >> >> wrote:
> >> >> > Hi All,
> >> >> >
> >> >> > I am creating a SOAP message using axis2 soap-api and soap-impl.
> >> >> > First I
> >> >> > am
> >> >> > creating the SOAPPart and then I am adding the attachmentpart.
> >> >> >
> >> >> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes
> >> >> > the
> >> >> > soap
> >> >> > envelop and not the MIME message. Could somebody please clarify why
> >> >> > it
> >> >> > is
> >> >> > not writing the MIME message. Following is my code snippet....
> >> >> >
> >> >> >       soapMsg = MessageFactory.newInstance().createMessage();
> >> >> >       //setting the namespace declaration.
> >> >> >       SOAPPart sp = soapMsg.getSOAPPart();
> >> >> >       SOAPEnvelope se = sp.getEnvelope();
> >> >> >       soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
> >> >> > DEFAULT_ENCODING);
> >> >> >       soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
> >> >> >
> >> >> >      se.addChildElemet().......
> >> >> >
> >> >> >      then I am adding the attachments...like
> >> >> >      addAttachments(attachmentList);
> >> >> >
> >> >> >
> >> >> > private void addAttachments(List attachmentList) throws
> >> >> > SOAPException,
> >> >> > IOException {
> >> >> >       if (attachmentList != null && attachmentList.size() > 0) {
> >> >> >           Iterator attachmentit = attachmentList.iterator();
> >> >> >           while (attachmentit.hasNext()) {
> >> >> >               DataHandler dh = (DataHandler) attachmentit.next();
> >> >> >               AttachmentPart ap = soapMsg.createAttachmentPart();
> >> >> >               ap.setContentId(dh.getName());
> >> >> >               Object content = dh.getContent();
> >> >> >               ap.setContent(dh.getContent(), dh.getContentType());
> >> >> >               soapMsg.addAttachmentPart(ap);
> >> >> >           }
> >> >> >       }
> >> >> >   }
> >> >> >
> >> >> >
> >> >> > Thanks,
> >> >> > Chinmoy
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >> >>
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: SOAPMessage with attachment problem

Posted by Andreas Veithen <an...@gmail.com>.
Chinmoy,

The error indeed indicates that you also need to upgrade to a newer
AXIOM version. Snapshots are available from [1]. For the other issue:
the next Axis2 release will indeed require Java 1.5. If upgrading to
that Java version is not an option for you, please have a look at
retrotranslator [2].

Andreas

[1] http://people.apache.org/repo/m2-snapshot-repository/org/apache/ws/commons/axiom/
[2] http://retrotranslator.sourceforge.net/

On Tue, Dec 2, 2008 at 06:34, Chinmoy Chakraborty <cc...@gmail.com> wrote:
> Andreas,
>
> I have downloaded the axis2-saaj-SNAPSHOT.jar from the [2] link but I am
> getting following error:
>
> Caused by: java.lang.NoSuchMethodError:
> org.apache.axiom.om.impl.MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(Ljavax/activation/DataHandler;Ljava/lang/String;Ljava/io/OutputStream;Ljava/util/Map;Lorg/apache/axiom/om/OMOutputFormat;)V
>  at org.apache.axis2.saaj.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:327)
>
> I guess I need to download latest axiom code also. Could you please tell me
> the url? One more thing I noticed latest saaj-impl code has been compiled in
> jdk 1.5 and as I have been running jdk1.4 it was giving version error. Do
> you plan to compile this in jdk 1.4 also?
>
> Chinmoy
>
>
>
>
>
>
> On Mon, Dec 1, 2008 at 5:45 PM, Andreas Veithen <an...@gmail.com>
> wrote:
>>
>> Chinmoy,
>>
>> You can either build it from sources (using the Subversion repository
>> at [1]) or wait for the next build and pick up the JAR at [2]. I don't
>> know the exact build schedule, but a new build should be available
>> within 24 hrs. Also, be aware that axis2-saaj-api no longer exists,
>> but has been moved to Geronimo.
>>
>> Andreas
>>
>> [1] http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/
>> [2]
>> http://people.apache.org/repo/m2-snapshot-repository/org/apache/axis2/axis2-saaj/SNAPSHOT/
>>
>>
>> On Mon, Dec 1, 2008 at 12:48, Chinmoy Chakraborty <cc...@gmail.com>
>> wrote:
>> > Hi Andreas,
>> >
>> > Thanks for reply. How do I get the fixed version? From where do I get
>> > latest
>> > jars?
>> >
>> > Chinmoy
>> >
>> > On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen
>> > <an...@gmail.com>
>> > wrote:
>> >>
>> >> Chinmoy,
>> >>
>> >> It is not writing MIME messages because the writeTo method was not
>> >> implemented correctly. This should now be fixed in trunk.
>> >>
>> >> Andreas
>> >>
>> >> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <cc...@gmail.com>
>> >> wrote:
>> >> > Hi All,
>> >> >
>> >> > I am creating a SOAP message using axis2 soap-api and soap-impl.
>> >> > First I
>> >> > am
>> >> > creating the SOAPPart and then I am adding the attachmentpart.
>> >> >
>> >> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes
>> >> > the
>> >> > soap
>> >> > envelop and not the MIME message. Could somebody please clarify why
>> >> > it
>> >> > is
>> >> > not writing the MIME message. Following is my code snippet....
>> >> >
>> >> >       soapMsg = MessageFactory.newInstance().createMessage();
>> >> >       //setting the namespace declaration.
>> >> >       SOAPPart sp = soapMsg.getSOAPPart();
>> >> >       SOAPEnvelope se = sp.getEnvelope();
>> >> >       soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
>> >> > DEFAULT_ENCODING);
>> >> >       soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
>> >> >
>> >> >      se.addChildElemet().......
>> >> >
>> >> >      then I am adding the attachments...like
>> >> >      addAttachments(attachmentList);
>> >> >
>> >> >
>> >> > private void addAttachments(List attachmentList) throws
>> >> > SOAPException,
>> >> > IOException {
>> >> >       if (attachmentList != null && attachmentList.size() > 0) {
>> >> >           Iterator attachmentit = attachmentList.iterator();
>> >> >           while (attachmentit.hasNext()) {
>> >> >               DataHandler dh = (DataHandler) attachmentit.next();
>> >> >               AttachmentPart ap = soapMsg.createAttachmentPart();
>> >> >               ap.setContentId(dh.getName());
>> >> >               Object content = dh.getContent();
>> >> >               ap.setContent(dh.getContent(), dh.getContentType());
>> >> >               soapMsg.addAttachmentPart(ap);
>> >> >           }
>> >> >       }
>> >> >   }
>> >> >
>> >> >
>> >> > Thanks,
>> >> > Chinmoy
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: SOAPMessage with attachment problem

Posted by Chinmoy Chakraborty <cc...@gmail.com>.
Andreas,

I have downloaded the axis2-saaj-SNAPSHOT.jar from the [2] link but I am
getting following error:

Caused by: java.lang.NoSuchMethodError:
org.apache.axiom.om.impl.MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(Ljavax/activation/DataHandler;Ljava/lang/String;Ljava/io/OutputStream;Ljava/util/Map;Lorg/apache/axiom/om/OMOutputFormat;)V
 at org.apache.axis2.saaj.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:327)

I guess I need to download latest axiom code also. Could you please tell me
the url? One more thing I noticed latest saaj-impl code has been compiled in
jdk 1.5 and as I have been running jdk1.4 it was giving version error. Do
you plan to compile this in jdk 1.4 also?

Chinmoy







On Mon, Dec 1, 2008 at 5:45 PM, Andreas Veithen
<an...@gmail.com>wrote:

> Chinmoy,
>
> You can either build it from sources (using the Subversion repository
> at [1]) or wait for the next build and pick up the JAR at [2]. I don't
> know the exact build schedule, but a new build should be available
> within 24 hrs. Also, be aware that axis2-saaj-api no longer exists,
> but has been moved to Geronimo.
>
> Andreas
>
> [1] http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/
> [2]
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/axis2/axis2-saaj/SNAPSHOT/
>
>
> On Mon, Dec 1, 2008 at 12:48, Chinmoy Chakraborty <cc...@gmail.com>
> wrote:
> > Hi Andreas,
> >
> > Thanks for reply. How do I get the fixed version? From where do I get
> latest
> > jars?
> >
> > Chinmoy
> >
> > On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen <
> andreas.veithen@gmail.com>
> > wrote:
> >>
> >> Chinmoy,
> >>
> >> It is not writing MIME messages because the writeTo method was not
> >> implemented correctly. This should now be fixed in trunk.
> >>
> >> Andreas
> >>
> >> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <cc...@gmail.com>
> >> wrote:
> >> > Hi All,
> >> >
> >> > I am creating a SOAP message using axis2 soap-api and soap-impl. First
> I
> >> > am
> >> > creating the SOAPPart and then I am adding the attachmentpart.
> >> >
> >> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes
> the
> >> > soap
> >> > envelop and not the MIME message. Could somebody please clarify why it
> >> > is
> >> > not writing the MIME message. Following is my code snippet....
> >> >
> >> >       soapMsg = MessageFactory.newInstance().createMessage();
> >> >       //setting the namespace declaration.
> >> >       SOAPPart sp = soapMsg.getSOAPPart();
> >> >       SOAPEnvelope se = sp.getEnvelope();
> >> >       soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
> >> > DEFAULT_ENCODING);
> >> >       soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
> >> >
> >> >      se.addChildElemet().......
> >> >
> >> >      then I am adding the attachments...like
> >> >      addAttachments(attachmentList);
> >> >
> >> >
> >> > private void addAttachments(List attachmentList) throws SOAPException,
> >> > IOException {
> >> >       if (attachmentList != null && attachmentList.size() > 0) {
> >> >           Iterator attachmentit = attachmentList.iterator();
> >> >           while (attachmentit.hasNext()) {
> >> >               DataHandler dh = (DataHandler) attachmentit.next();
> >> >               AttachmentPart ap = soapMsg.createAttachmentPart();
> >> >               ap.setContentId(dh.getName());
> >> >               Object content = dh.getContent();
> >> >               ap.setContent(dh.getContent(), dh.getContentType());
> >> >               soapMsg.addAttachmentPart(ap);
> >> >           }
> >> >       }
> >> >   }
> >> >
> >> >
> >> > Thanks,
> >> > Chinmoy
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: SOAPMessage with attachment problem

Posted by Andreas Veithen <an...@gmail.com>.
Chinmoy,

You can either build it from sources (using the Subversion repository
at [1]) or wait for the next build and pick up the JAR at [2]. I don't
know the exact build schedule, but a new build should be available
within 24 hrs. Also, be aware that axis2-saaj-api no longer exists,
but has been moved to Geronimo.

Andreas

[1] http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/
[2] http://people.apache.org/repo/m2-snapshot-repository/org/apache/axis2/axis2-saaj/SNAPSHOT/


On Mon, Dec 1, 2008 at 12:48, Chinmoy Chakraborty <cc...@gmail.com> wrote:
> Hi Andreas,
>
> Thanks for reply. How do I get the fixed version? From where do I get latest
> jars?
>
> Chinmoy
>
> On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen <an...@gmail.com>
> wrote:
>>
>> Chinmoy,
>>
>> It is not writing MIME messages because the writeTo method was not
>> implemented correctly. This should now be fixed in trunk.
>>
>> Andreas
>>
>> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <cc...@gmail.com>
>> wrote:
>> > Hi All,
>> >
>> > I am creating a SOAP message using axis2 soap-api and soap-impl. First I
>> > am
>> > creating the SOAPPart and then I am adding the attachmentpart.
>> >
>> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes the
>> > soap
>> > envelop and not the MIME message. Could somebody please clarify why it
>> > is
>> > not writing the MIME message. Following is my code snippet....
>> >
>> >       soapMsg = MessageFactory.newInstance().createMessage();
>> >       //setting the namespace declaration.
>> >       SOAPPart sp = soapMsg.getSOAPPart();
>> >       SOAPEnvelope se = sp.getEnvelope();
>> >       soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
>> > DEFAULT_ENCODING);
>> >       soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
>> >
>> >      se.addChildElemet().......
>> >
>> >      then I am adding the attachments...like
>> >      addAttachments(attachmentList);
>> >
>> >
>> > private void addAttachments(List attachmentList) throws SOAPException,
>> > IOException {
>> >       if (attachmentList != null && attachmentList.size() > 0) {
>> >           Iterator attachmentit = attachmentList.iterator();
>> >           while (attachmentit.hasNext()) {
>> >               DataHandler dh = (DataHandler) attachmentit.next();
>> >               AttachmentPart ap = soapMsg.createAttachmentPart();
>> >               ap.setContentId(dh.getName());
>> >               Object content = dh.getContent();
>> >               ap.setContent(dh.getContent(), dh.getContentType());
>> >               soapMsg.addAttachmentPart(ap);
>> >           }
>> >       }
>> >   }
>> >
>> >
>> > Thanks,
>> > Chinmoy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: SOAPMessage with attachment problem

Posted by Chinmoy Chakraborty <cc...@gmail.com>.
Hi Andreas,

Thanks for reply. How do I get the fixed version? From where do I get latest
jars?

Chinmoy

On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen
<an...@gmail.com>wrote:

> Chinmoy,
>
> It is not writing MIME messages because the writeTo method was not
> implemented correctly. This should now be fixed in trunk.
>
> Andreas
>
> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <cc...@gmail.com>
> wrote:
> > Hi All,
> >
> > I am creating a SOAP message using axis2 soap-api and soap-impl. First I
> am
> > creating the SOAPPart and then I am adding the attachmentpart.
> >
> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes the
> soap
> > envelop and not the MIME message. Could somebody please clarify why it is
> > not writing the MIME message. Following is my code snippet....
> >
> >       soapMsg = MessageFactory.newInstance().createMessage();
> >       //setting the namespace declaration.
> >       SOAPPart sp = soapMsg.getSOAPPart();
> >       SOAPEnvelope se = sp.getEnvelope();
> >       soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
> DEFAULT_ENCODING);
> >       soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
> >
> >      se.addChildElemet().......
> >
> >      then I am adding the attachments...like
> >      addAttachments(attachmentList);
> >
> >
> > private void addAttachments(List attachmentList) throws SOAPException,
> > IOException {
> >       if (attachmentList != null && attachmentList.size() > 0) {
> >           Iterator attachmentit = attachmentList.iterator();
> >           while (attachmentit.hasNext()) {
> >               DataHandler dh = (DataHandler) attachmentit.next();
> >               AttachmentPart ap = soapMsg.createAttachmentPart();
> >               ap.setContentId(dh.getName());
> >               Object content = dh.getContent();
> >               ap.setContent(dh.getContent(), dh.getContentType());
> >               soapMsg.addAttachmentPart(ap);
> >           }
> >       }
> >   }
> >
> >
> > Thanks,
> > Chinmoy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: SOAPMessage with attachment problem

Posted by Andreas Veithen <an...@gmail.com>.
Chinmoy,

It is not writing MIME messages because the writeTo method was not
implemented correctly. This should now be fixed in trunk.

Andreas

On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <cc...@gmail.com> wrote:
> Hi All,
>
> I am creating a SOAP message using axis2 soap-api and soap-impl. First I am
> creating the SOAPPart and then I am adding the attachmentpart.
>
> Now, when I do soapMessage.writeTo(OuputStream out), it only writes the soap
> envelop and not the MIME message. Could somebody please clarify why it is
> not writing the MIME message. Following is my code snippet....
>
>       soapMsg = MessageFactory.newInstance().createMessage();
>       //setting the namespace declaration.
>       SOAPPart sp = soapMsg.getSOAPPart();
>       SOAPEnvelope se = sp.getEnvelope();
>       soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING, DEFAULT_ENCODING);
>       soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
>
>      se.addChildElemet().......
>
>      then I am adding the attachments...like
>      addAttachments(attachmentList);
>
>
> private void addAttachments(List attachmentList) throws SOAPException,
> IOException {
>       if (attachmentList != null && attachmentList.size() > 0) {
>           Iterator attachmentit = attachmentList.iterator();
>           while (attachmentit.hasNext()) {
>               DataHandler dh = (DataHandler) attachmentit.next();
>               AttachmentPart ap = soapMsg.createAttachmentPart();
>               ap.setContentId(dh.getName());
>               Object content = dh.getContent();
>               ap.setContent(dh.getContent(), dh.getContentType());
>               soapMsg.addAttachmentPart(ap);
>           }
>       }
>   }
>
>
> Thanks,
> Chinmoy

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org