Re: Error getting attachments from SOAPMessage

2009-01-27 Thread Andreas Veithen
Chinmoy,

I had to do some more changes in order to make axis2-saaj compatible
with the SAAJ specs and Sun's reference implementation. I believe that
the issue should be fixed now in trunk. However:

* For the DataHandler issue: the code in trunk still creates the
AttachmentPart directly from the DataHandler produced by Axiom, i.e.
it does not use AttachmentPartImpl#setContent(dh.getInputStream(),
dh.getContentType()). The existing code had some troubles to correctly
populate the MimeHeader objects which might explain the issue
(Mapping qname not fond for the package:
org.apache.axiom.attachments.impl) you have seen. If this still
persists, then we need to further investigate.

* I didn't understand your comment about Sun's SAAJ implementation
expecting the 'type' property in the second position in the
'Content-Type' string. Therefore I didn't implement any specific
change related to this. Can you explain this issue a bit more?

As usual, a new snapshot with the changes should be available within
the next 24hrs.

Regards,

Andreas

On Thu, Jan 8, 2009 at 09:17, Chinmoy Chakraborty cch...@gmail.com wrote:
 Andreas,

 I tried MessageFactoryTest and all the tests passed. I have following notes
 for the test:

 1. For sun SAAJ implementation, I noticed 'type' property should be in the
 second position in the 'Content-Type' string.
 2. Old saaj-impl.jar fails MTOM test because old saaj did not implement MTOM
 feature. I had to use jdk 1.6 to test MTOM feature. Hence I had to change
 sun SAAJ messagefactory namespace
 (com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl())
 in SAAJTestUtil.

 Following is the stack trace for the issue I am getting forI
 AttachmentPartImpl#setDataHandler

 org.apache.axis2.AxisFault: Mapping qname not fond for the package:
 org.apache.axiom.attachments.impl
  at
 org.apache.axis2.databinding.utils.BeanUtil.getPullParser(BeanUtil.java:305)
  at org.apache.axis2.rpc.receivers.RPCUtil.processResponse(RPCUtil.java:97)
  at
 org.apache.axis2.rpc.receivers.RPCUtil.processResponseAsDocLitWrapped(RPCUtil.java:437)
  at
 org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:138)
  at
 org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
  at
 org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
  at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
  at
 org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
  at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:131)

 Please find attached modified files.

 Chinmoy


 On Thu, Jan 8, 2009 at 4:12 AM, Andreas Veithen andreas.veit...@gmail.com
 wrote:

 See my comments inline.

 I also committed my test cases to axis2-saaj (see MessageFactoryTest).
 Obviously, since they don't pass yet, there are commented out. Can you
 uncomment them and check your modifications against them?

 Andreas

 On Mon, Jan 5, 2009 at 07:43, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  Andreas,
 
  As you mentioned about the SAAJ spec, I removed the code for setting
  SOAPPart content-id in SOAPPartImpl. I also modified the code in
  SOAPMessageImpl.

 Your code should set the contentId property, but it should add the
 angle brackets.

  Now, if I do AttachmentPartImpl#setDataHandler I get this error:
 
  org.apache.axis2.AxisFault: Mapping qname not fond for the package:
  org.apache.axiom.attachments.impl

 Strange. Can you post the full stack trace?

  So I did, AttachmentPartImpl#setContent(dh.getInputStream(),
  dh.getContentType());
 
  Is anything wrong in the above code?

 I think that it unnecessarily copies data around.

  Please find modified two files.
 
  One more thing, in the client side when I am retrieving the datahandler,
  it
  loses the Content-Type and DataHnadler#getName becomes
  ByteArrayDataSource. The content-type becomes
  application/octet-stream.
  Please tell me how to preserve the content-type and getName information
  of
  DataHandler in the client side?

 I don't think that one can expect that the getName information be
 preserved (where would this information be stored in the message?).
 Obviously the content type should be preserved. I will have to
 investigate this.

  Chinmoy
 
  On Mon, Jan 5, 2009 at 4:05 AM, Andreas Veithen
  andreas.veit...@gmail.com
  wrote:
 
  Chinmoy,
 
  I've started to write some unit tests that compare the behavior of
  createMessage in Axis2's SAAJ implementation (including your proposed
  changes) with Sun's reference implementation. One issue I see is
  related to the way the contentId property is set on SOAPPart and
  AttachmentPart. The SAAJ spec describes the behavior of getContentId
  as follows:
 
  [quote] Gets the value of the MIME header whose name is Content-Id.
  [/quote]
 
  This means that it should return the content ID enclosed in angle
  

Re: Error getting attachments from SOAPMessage

2009-01-07 Thread Andreas Veithen
See my comments inline.

I also committed my test cases to axis2-saaj (see MessageFactoryTest).
Obviously, since they don't pass yet, there are commented out. Can you
uncomment them and check your modifications against them?

Andreas

On Mon, Jan 5, 2009 at 07:43, Chinmoy Chakraborty cch...@gmail.com wrote:
 Andreas,

 As you mentioned about the SAAJ spec, I removed the code for setting
 SOAPPart content-id in SOAPPartImpl. I also modified the code in
 SOAPMessageImpl.

Your code should set the contentId property, but it should add the
angle brackets.

 Now, if I do AttachmentPartImpl#setDataHandler I get this error:

 org.apache.axis2.AxisFault: Mapping qname not fond for the package:
 org.apache.axiom.attachments.impl

Strange. Can you post the full stack trace?

 So I did, AttachmentPartImpl#setContent(dh.getInputStream(),
 dh.getContentType());

 Is anything wrong in the above code?

I think that it unnecessarily copies data around.

 Please find modified two files.

 One more thing, in the client side when I am retrieving the datahandler, it
 loses the Content-Type and DataHnadler#getName becomes
 ByteArrayDataSource. The content-type becomes application/octet-stream.
 Please tell me how to preserve the content-type and getName information of
 DataHandler in the client side?

I don't think that one can expect that the getName information be
preserved (where would this information be stored in the message?).
Obviously the content type should be preserved. I will have to
investigate this.

 Chinmoy

 On Mon, Jan 5, 2009 at 4:05 AM, Andreas Veithen andreas.veit...@gmail.com
 wrote:

 Chinmoy,

 I've started to write some unit tests that compare the behavior of
 createMessage in Axis2's SAAJ implementation (including your proposed
 changes) with Sun's reference implementation. One issue I see is
 related to the way the contentId property is set on SOAPPart and
 AttachmentPart. The SAAJ spec describes the behavior of getContentId
 as follows:

 [quote] Gets the value of the MIME header whose name is Content-Id.
 [/quote]

 This means that it should return the content ID enclosed in angle
 brackets (which is the behavior of Sun's implementation). Since your
 code fetches the content ID from Axiom and Axiom stores the bare
 content ID (i.e. strips the angle brackets), this requirement is not
 satisfied.

 Also, I was wondering why your code uses AttachmentPartImpl#setContent
 and not just AttachmentPartImpl#setDataHandler. Is there any
 particular reason?

 Andreas

 On Fri, Jan 2, 2009 at 07:15, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  Hi Andreas,
 
  Now I removed the duplicate code from SOAPMessageImpl. I also added one
  line
  (line no. 147) to set the content id of SOAPPart. Please find attached
  two
  modified java file.
 
  Chinmoy
 
 
 
  On Fri, Jan 2, 2009 at 9:48 AM, Chinmoy Chakraborty cch...@gmail.com
  wrote:
 
  Hi Andreas,
 
  Yes, the code for extracting rootcontent-id is duplicate code. The code
  can be put in a protected method in SOAPPartImpl.I had to do that
  because,
  in Attachments SOAPPart comes also as attachment. It requires to
  discard
  SOAPPart attachment from the attachment map while adding the
  attachments in
  SOAPMessage..
 
  In the attachment map, the content-ids are stored as key and
  datahandler
  as the value. I am adding the attachments in SOAPMessage if it is not
  SOAPPart. For that I needed the rootcontentid i.e. the id for the
  SOAPPart.
  I am extrracting that id from Content-Type string. So it can include
  '',
  '', and cid:.
 
 
  Chinmoy
 
 
  On Thu, Jan 1, 2009 at 8:42 PM, Andreas Veithen
  andreas.veit...@gmail.com wrote:
 
  Chinmoy,
 
  The code you added in SOAPMessageImpl to some extent duplicates the
  code in Attachments#getSOAPPartContentID. Is there a particular reason
  for this?
 
  Andreas
 
  On Wed, Dec 31, 2008 at 14:59, Chinmoy Chakraborty cch...@gmail.com
  wrote:
   Hi Andreas,
  
   I walked through the code (org.apache.axis2.saaj.SOAPMessageImpl)
   and
   fixed
   the attachment issue. I have added some code from line no. 111 to
   149
   of
   attached org.apache.axis2.saaj.SOAPMessageImpl class that fixes the
   attachemnt issue while creating SOAP with attachment from
   inputstream.
  
   I also have added a protected method in
   org.apache.axis2.saaj.SOAPPartImpl
   class. The code code is:
  
   protected Map getAttachmentMap(){
   if(attachments != null){
   return attachments.getMap();
   }
   return null;
   }
  
   I have also declared a private variable in SOAPPartImpl: private
   Attachments
   attachments = null;
  
   I am attaching these files along with this mail. The modified code
   works
   fine for me now while creating SOAP with attachments from
   inputstream.
  
   If you find the changes fine please commit. I can download fresh
   axis-saaj-SNAPSHOT jar. Please give your opinion.
  
   Chinmoy
  
  
  
   On Tue, Dec 23, 2008 at 9:15 PM, Andreas Veithen
   

Re: Error getting attachments from SOAPMessage

2009-01-04 Thread Andreas Veithen
Chinmoy,

I've started to write some unit tests that compare the behavior of
createMessage in Axis2's SAAJ implementation (including your proposed
changes) with Sun's reference implementation. One issue I see is
related to the way the contentId property is set on SOAPPart and
AttachmentPart. The SAAJ spec describes the behavior of getContentId
as follows:

[quote] Gets the value of the MIME header whose name is Content-Id. [/quote]

This means that it should return the content ID enclosed in angle
brackets (which is the behavior of Sun's implementation). Since your
code fetches the content ID from Axiom and Axiom stores the bare
content ID (i.e. strips the angle brackets), this requirement is not
satisfied.

Also, I was wondering why your code uses AttachmentPartImpl#setContent
and not just AttachmentPartImpl#setDataHandler. Is there any
particular reason?

Andreas

On Fri, Jan 2, 2009 at 07:15, Chinmoy Chakraborty cch...@gmail.com wrote:
 Hi Andreas,

 Now I removed the duplicate code from SOAPMessageImpl. I also added one line
 (line no. 147) to set the content id of SOAPPart. Please find attached two
 modified java file.

 Chinmoy



 On Fri, Jan 2, 2009 at 9:48 AM, Chinmoy Chakraborty cch...@gmail.com
 wrote:

 Hi Andreas,

 Yes, the code for extracting rootcontent-id is duplicate code. The code
 can be put in a protected method in SOAPPartImpl.I had to do that because,
 in Attachments SOAPPart comes also as attachment. It requires to discard
 SOAPPart attachment from the attachment map while adding the attachments in
 SOAPMessage..

 In the attachment map, the content-ids are stored as key and datahandler
 as the value. I am adding the attachments in SOAPMessage if it is not
 SOAPPart. For that I needed the rootcontentid i.e. the id for the SOAPPart.
 I am extrracting that id from Content-Type string. So it can include '',
 '', and cid:.


 Chinmoy


 On Thu, Jan 1, 2009 at 8:42 PM, Andreas Veithen
 andreas.veit...@gmail.com wrote:

 Chinmoy,

 The code you added in SOAPMessageImpl to some extent duplicates the
 code in Attachments#getSOAPPartContentID. Is there a particular reason
 for this?

 Andreas

 On Wed, Dec 31, 2008 at 14:59, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  Hi Andreas,
 
  I walked through the code (org.apache.axis2.saaj.SOAPMessageImpl) and
  fixed
  the attachment issue. I have added some code from line no. 111 to 149
  of
  attached org.apache.axis2.saaj.SOAPMessageImpl class that fixes the
  attachemnt issue while creating SOAP with attachment from inputstream.
 
  I also have added a protected method in
  org.apache.axis2.saaj.SOAPPartImpl
  class. The code code is:
 
  protected Map getAttachmentMap(){
  if(attachments != null){
  return attachments.getMap();
  }
  return null;
  }
 
  I have also declared a private variable in SOAPPartImpl: private
  Attachments
  attachments = null;
 
  I am attaching these files along with this mail. The modified code
  works
  fine for me now while creating SOAP with attachments from inputstream.
 
  If you find the changes fine please commit. I can download fresh
  axis-saaj-SNAPSHOT jar. Please give your opinion.
 
  Chinmoy
 
 
 
  On Tue, Dec 23, 2008 at 9:15 PM, Andreas Veithen
  andreas.veit...@gmail.com
  wrote:
 
  On Tue, Dec 23, 2008 at 12:17, Chinmoy Chakraborty cch...@gmail.com
  wrote:
   Andreas,
  
   I am stuck with the attachments. I have sent many mails in this
   forum
   mentioning the issue regarding creation of SOAPMessage with
   attachments
   from
   Inputstream but no one replied me back.
  
   Previously you have mentioned that asix saaj api has been moved to
   gerenimo.
   Could you please send me the url from where I can get the geronimo
   SNAPSHOT
   jar?
 
  The SAAJ API version used by Axis2 can be found at [1]. Note that
  there are currently no snapshots, because as an API it is not under
  active development (it is just the translation into Java code of a
  specification, so it's fairly static).
 
  [1]
 
  http://repo1.maven.org/maven2/org/apache/geronimo/specs/geronimo-saaj_1.3_spec/1.0.1/
 
   Could you send me the email-id of the developer who is working on
   axis-saaj
   implementation by which I can contact him directly. I am really
   really
   stuck
   here with my latest project. This is urgent for me. Please help.
 
  I think that the SAAJ implementation is the work of several people. It
  has been around for some time, so I don't know exactly who is the most
  familiar with the code. You may have a look at [2] to see who worked
  on it. The corresponding email addresses can be found at [3].
 
  [2]
 
  http://svnsearch.org/svnsearch/repos/ASF/search?path=%2Fwebservices%2Faxis2%2Ftrunk%2Fjava%2Fmodules%2Fsaaj
  [3] http://ws.apache.org/axis2/team-list.html
 
  
   Chinmoy
  
  
  
   On Thu, Dec 18, 2008 at 8:54 PM, Andreas Veithen
   andreas.veit...@gmail.com
   wrote:
  
   Chinmoy,
  
   I walked through the axis2-saaj code and indeed when 

Re: Error getting attachments from SOAPMessage

2009-01-01 Thread Andreas Veithen
Chinmoy,

The code you added in SOAPMessageImpl to some extent duplicates the
code in Attachments#getSOAPPartContentID. Is there a particular reason
for this?

Andreas

On Wed, Dec 31, 2008 at 14:59, Chinmoy Chakraborty cch...@gmail.com wrote:
 Hi Andreas,

 I walked through the code (org.apache.axis2.saaj.SOAPMessageImpl) and fixed
 the attachment issue. I have added some code from line no. 111 to 149 of
 attached org.apache.axis2.saaj.SOAPMessageImpl class that fixes the
 attachemnt issue while creating SOAP with attachment from inputstream.

 I also have added a protected method in org.apache.axis2.saaj.SOAPPartImpl
 class. The code code is:

 protected Map getAttachmentMap(){
 if(attachments != null){
 return attachments.getMap();
 }
 return null;
 }

 I have also declared a private variable in SOAPPartImpl: private Attachments
 attachments = null;

 I am attaching these files along with this mail. The modified code works
 fine for me now while creating SOAP with attachments from inputstream.

 If you find the changes fine please commit. I can download fresh
 axis-saaj-SNAPSHOT jar. Please give your opinion.

 Chinmoy



 On Tue, Dec 23, 2008 at 9:15 PM, Andreas Veithen andreas.veit...@gmail.com
 wrote:

 On Tue, Dec 23, 2008 at 12:17, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  Andreas,
 
  I am stuck with the attachments. I have sent many mails in this forum
  mentioning the issue regarding creation of SOAPMessage with attachments
  from
  Inputstream but no one replied me back.
 
  Previously you have mentioned that asix saaj api has been moved to
  gerenimo.
  Could you please send me the url from where I can get the geronimo
  SNAPSHOT
  jar?

 The SAAJ API version used by Axis2 can be found at [1]. Note that
 there are currently no snapshots, because as an API it is not under
 active development (it is just the translation into Java code of a
 specification, so it's fairly static).

 [1]
 http://repo1.maven.org/maven2/org/apache/geronimo/specs/geronimo-saaj_1.3_spec/1.0.1/

  Could you send me the email-id of the developer who is working on
  axis-saaj
  implementation by which I can contact him directly. I am really really
  stuck
  here with my latest project. This is urgent for me. Please help.

 I think that the SAAJ implementation is the work of several people. It
 has been around for some time, so I don't know exactly who is the most
 familiar with the code. You may have a look at [2] to see who worked
 on it. The corresponding email addresses can be found at [3].

 [2]
 http://svnsearch.org/svnsearch/repos/ASF/search?path=%2Fwebservices%2Faxis2%2Ftrunk%2Fjava%2Fmodules%2Fsaaj
 [3] http://ws.apache.org/axis2/team-list.html

 
  Chinmoy
 
 
 
  On Thu, Dec 18, 2008 at 8:54 PM, Andreas Veithen
  andreas.veit...@gmail.com
  wrote:
 
  Chinmoy,
 
  I walked through the axis2-saaj code and indeed when creating a
  message from an input stream using MessageFactory, axis2-saaj doesn't
  even request the attachments from Axiom. However, I'm not familiar
  enough with the code to be able to fix this myself.
 
  Maybe somebody else can help here?
 
  Andreas
 
  On Thu, Dec 18, 2008 at 13:05, Chinmoy Chakraborty cch...@gmail.com
  wrote:
   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,
   

Re: Error getting attachments from SOAPMessage

2009-01-01 Thread Chinmoy Chakraborty
Hi Andreas,

Yes, the code for extracting rootcontent-id is duplicate code. The code can
be put in a protected method in SOAPPartImpl.I had to do that because, in
Attachments SOAPPart comes also as attachment. It requires to discard
SOAPPart attachment from the attachment map while adding the attachments in
SOAPMessage..

In the attachment map, the content-ids are stored as key and datahandler as
the value. I am adding the attachments in SOAPMessage if it is not SOAPPart.
For that I needed the rootcontentid i.e. the id for the SOAPPart. I am
extrracting that id from Content-Type string. So it can include '', '',
and cid:.


Chinmoy



On Thu, Jan 1, 2009 at 8:42 PM, Andreas Veithen
andreas.veit...@gmail.comwrote:

 Chinmoy,

 The code you added in SOAPMessageImpl to some extent duplicates the
 code in Attachments#getSOAPPartContentID. Is there a particular reason
 for this?

 Andreas

 On Wed, Dec 31, 2008 at 14:59, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  Hi Andreas,
 
  I walked through the code (org.apache.axis2.saaj.SOAPMessageImpl) and
 fixed
  the attachment issue. I have added some code from line no. 111 to 149 of
  attached org.apache.axis2.saaj.SOAPMessageImpl class that fixes the
  attachemnt issue while creating SOAP with attachment from inputstream.
 
  I also have added a protected method in
 org.apache.axis2.saaj.SOAPPartImpl
  class. The code code is:
 
  protected Map getAttachmentMap(){
  if(attachments != null){
  return attachments.getMap();
  }
  return null;
  }
 
  I have also declared a private variable in SOAPPartImpl: private
 Attachments
  attachments = null;
 
  I am attaching these files along with this mail. The modified code works
  fine for me now while creating SOAP with attachments from inputstream.
 
  If you find the changes fine please commit. I can download fresh
  axis-saaj-SNAPSHOT jar. Please give your opinion.
 
  Chinmoy
 
 
 
  On Tue, Dec 23, 2008 at 9:15 PM, Andreas Veithen 
 andreas.veit...@gmail.com
  wrote:
 
  On Tue, Dec 23, 2008 at 12:17, Chinmoy Chakraborty cch...@gmail.com
  wrote:
   Andreas,
  
   I am stuck with the attachments. I have sent many mails in this forum
   mentioning the issue regarding creation of SOAPMessage with
 attachments
   from
   Inputstream but no one replied me back.
  
   Previously you have mentioned that asix saaj api has been moved to
   gerenimo.
   Could you please send me the url from where I can get the geronimo
   SNAPSHOT
   jar?
 
  The SAAJ API version used by Axis2 can be found at [1]. Note that
  there are currently no snapshots, because as an API it is not under
  active development (it is just the translation into Java code of a
  specification, so it's fairly static).
 
  [1]
 
 http://repo1.maven.org/maven2/org/apache/geronimo/specs/geronimo-saaj_1.3_spec/1.0.1/
 
   Could you send me the email-id of the developer who is working on
   axis-saaj
   implementation by which I can contact him directly. I am really really
   stuck
   here with my latest project. This is urgent for me. Please help.
 
  I think that the SAAJ implementation is the work of several people. It
  has been around for some time, so I don't know exactly who is the most
  familiar with the code. You may have a look at [2] to see who worked
  on it. The corresponding email addresses can be found at [3].
 
  [2]
 
 http://svnsearch.org/svnsearch/repos/ASF/search?path=%2Fwebservices%2Faxis2%2Ftrunk%2Fjava%2Fmodules%2Fsaaj
  [3] http://ws.apache.org/axis2/team-list.html
 
  
   Chinmoy
  
  
  
   On Thu, Dec 18, 2008 at 8:54 PM, Andreas Veithen
   andreas.veit...@gmail.com
   wrote:
  
   Chinmoy,
  
   I walked through the axis2-saaj code and indeed when creating a
   message from an input stream using MessageFactory, axis2-saaj doesn't
   even request the attachments from Axiom. However, I'm not familiar
   enough with the code to be able to fix this myself.
  
   Maybe somebody else can help here?
  
   Andreas
  
   On Thu, Dec 18, 2008 at 13:05, Chinmoy Chakraborty cch...@gmail.com
 
   wrote:
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();
  

Re: Error getting attachments from SOAPMessage

2008-12-23 Thread Chinmoy Chakraborty
Andreas,

I am stuck with the attachments. I have sent many mails in this forum
mentioning the issue regarding creation of SOAPMessage with attachments from
Inputstream but no one replied me back.

Previously you have mentioned that asix saaj api has been moved to gerenimo.
Could you please send me the url from where I can get the geronimo SNAPSHOT
jar?

Could you send me the email-id of the developer who is working on axis-saaj
implementation by which I can contact him directly. I am really really stuck
here with my latest project. This is urgent for me. Please help.


Chinmoy




On Thu, Dec 18, 2008 at 8:54 PM, Andreas Veithen
andreas.veit...@gmail.comwrote:

 Chinmoy,

 I walked through the axis2-saaj code and indeed when creating a
 message from an input stream using MessageFactory, axis2-saaj doesn't
 even request the attachments from Axiom. However, I'm not familiar
 enough with the code to be able to fix this myself.

 Maybe somebody else can help here?

 Andreas

 On Thu, Dec 18, 2008 at 13:05, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  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 
 andreas.veit...@gmail.com
  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 cch...@gmail.com
  wrote:
   Andreas,
  
   Here is my code snippet.
  
   String contentType = multipart/related;
boundary=MIMEBoundaryurn_uuid_D988AB74BC9802BDC21229577126047;
type=text/xml;

   start=0.urn:uuid:d988ab74bc9802bdc21229577126...@apache.org0.urn%3auuid%3ad988ab74bc9802bdc21229577126...@apache.org
 
  
   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 

Re: Error getting attachments from SOAPMessage

2008-12-23 Thread Andreas Veithen
On Tue, Dec 23, 2008 at 12:17, Chinmoy Chakraborty cch...@gmail.com wrote:
 Andreas,

 I am stuck with the attachments. I have sent many mails in this forum
 mentioning the issue regarding creation of SOAPMessage with attachments from
 Inputstream but no one replied me back.

 Previously you have mentioned that asix saaj api has been moved to gerenimo.
 Could you please send me the url from where I can get the geronimo SNAPSHOT
 jar?

The SAAJ API version used by Axis2 can be found at [1]. Note that
there are currently no snapshots, because as an API it is not under
active development (it is just the translation into Java code of a
specification, so it's fairly static).

[1] 
http://repo1.maven.org/maven2/org/apache/geronimo/specs/geronimo-saaj_1.3_spec/1.0.1/

 Could you send me the email-id of the developer who is working on axis-saaj
 implementation by which I can contact him directly. I am really really stuck
 here with my latest project. This is urgent for me. Please help.

I think that the SAAJ implementation is the work of several people. It
has been around for some time, so I don't know exactly who is the most
familiar with the code. You may have a look at [2] to see who worked
on it. The corresponding email addresses can be found at [3].

[2] 
http://svnsearch.org/svnsearch/repos/ASF/search?path=%2Fwebservices%2Faxis2%2Ftrunk%2Fjava%2Fmodules%2Fsaaj
[3] http://ws.apache.org/axis2/team-list.html


 Chinmoy



 On Thu, Dec 18, 2008 at 8:54 PM, Andreas Veithen andreas.veit...@gmail.com
 wrote:

 Chinmoy,

 I walked through the axis2-saaj code and indeed when creating a
 message from an input stream using MessageFactory, axis2-saaj doesn't
 even request the attachments from Axiom. However, I'm not familiar
 enough with the code to be able to fix this myself.

 Maybe somebody else can help here?

 Andreas

 On Thu, Dec 18, 2008 at 13:05, Chinmoy Chakraborty cch...@gmail.com
 wrote:
  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
  andreas.veit...@gmail.com
  wrote:
 
  Chinmoy,
 
  Can you also attach a sample message that you try to read with this
  code?
 
  

Re: Error getting attachments from SOAPMessage

2008-12-18 Thread Andreas Veithen
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 cch...@gmail.com wrote:
 Andreas,

 Here is my code snippet.

 String contentType = multipart/related;
  boundary=MIMEBoundaryurn_uuid_D988AB74BC9802BDC21229577126047;
  type=text/xml;
  start=0.urn:uuid:d988ab74bc9802bdc21229577126...@apache.org

 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 andreas.veit...@gmail.com
 wrote:

 Chinmoy,

 Can you post the code that demonstrates the problem?

 Andreas

 On Wed, Dec 17, 2008 at 13:40, Chinmoy Chakraborty cch...@gmail.com
 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




Re: Error getting attachments from SOAPMessage

2008-12-18 Thread Chinmoy Chakraborty
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
andreas.veit...@gmail.comwrote:

 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 cch...@gmail.com
 wrote:
  Andreas,
 
  Here is my code snippet.
 
  String contentType = multipart/related;
   boundary=MIMEBoundaryurn_uuid_D988AB74BC9802BDC21229577126047;
   type=text/xml;
   
  start=0.urn:uuid:d988ab74bc9802bdc21229577126...@apache.org0.urn%3auuid%3ad988ab74bc9802bdc21229577126...@apache.org
 
 
  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 
 andreas.veit...@gmail.com
  wrote:
 
  Chinmoy,
 
  Can you post the code that demonstrates the problem?
 
  Andreas
 
  On Wed, Dec 17, 2008 at 13:40, Chinmoy Chakraborty cch...@gmail.com
  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 

Re: Error getting attachments from SOAPMessage

2008-12-18 Thread Andreas Veithen
Chinmoy,

I walked through the axis2-saaj code and indeed when creating a
message from an input stream using MessageFactory, axis2-saaj doesn't
even request the attachments from Axiom. However, I'm not familiar
enough with the code to be able to fix this myself.

Maybe somebody else can help here?

Andreas

On Thu, Dec 18, 2008 at 13:05, Chinmoy Chakraborty cch...@gmail.com wrote:
 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 andreas.veit...@gmail.com
 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 cch...@gmail.com
 wrote:
  Andreas,
 
  Here is my code snippet.
 
  String contentType = multipart/related;
   boundary=MIMEBoundaryurn_uuid_D988AB74BC9802BDC21229577126047;
   type=text/xml;
   start=0.urn:uuid:d988ab74bc9802bdc21229577126...@apache.org
 
  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
  andreas.veit...@gmail.com
  wrote:
 
  Chinmoy,
 
  Can you post the code 

Re: Error getting attachments from SOAPMessage

2008-12-17 Thread Andreas Veithen
Chinmoy,

Can you post the code that demonstrates the problem?

Andreas

On Wed, Dec 17, 2008 at 13:40, Chinmoy Chakraborty cch...@gmail.com 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


Re: Error getting attachments from SOAPMessage

2008-12-17 Thread Chinmoy Chakraborty
Andreas,

Here is my code snippet.

String contentType = multipart/related;
 boundary=MIMEBoundaryurn_uuid_D988AB74BC9802BDC21229577126047;
 type=text/xml;
 
start=0.urn:uuid:d988ab74bc9802bdc21229577126...@apache.org0.urn%3auuid%3ad988ab74bc9802bdc21229577126...@apache.org


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
andreas.veit...@gmail.comwrote:

 Chinmoy,

 Can you post the code that demonstrates the problem?

 Andreas

 On Wed, Dec 17, 2008 at 13:40, Chinmoy Chakraborty cch...@gmail.com
 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