The msg.createAttachment() method takes a javax.activation.DataHandler object as a parameter. Try creating the pdf attachment as a dataHandler object.
Did not do the trick.
When i call addAttachmentPart with a newly created attachment. I get back a null pointer.
I've browsed the code of apache but i'm not sure what it is doing. Has anyone have a simple example of creating a new soap message with an attachent.
I am in the middle of trying to setup a Web Service using message based protocol. I want to send back the response with an attachment. I am having all kinds of problems.
I am using jboss3.0.4 and have axis 1.0 installed.
I am able to send and receive soap messages but attachments are a real real headache.
There seems to be many ways of doing it but I can't get one way to work.
I hope we can work together to resolve it somehow.
I can post code or whatever.
Happy to hear i'm not the only one not understanding the attachment stuff.
What i'm doing does not involve a webservice. I just want to create a soap message with an attachment and then serialize the message to disk
If you want to mail me mail me to email@example.com
I found it.
You have to add activation.jar and mail.jar from the tomcat distribution in your classpath
hopes this helps for you as well
yes. you are right. The datahandler class is in the JAF package.
From my test cases I have determined that it is in fact a bug and that attachments don't work in version 3.0.4.
I added soap2.2 to my deploy directory. Compiled the samples and attachments work fine.
Here is what I did find out.
Axis works find RPC, MSG services except when you try
to get the Soap Envelope. At this point jboss (or Axis) seems to get confused and cannot locate several methods that actually exist. This happened for a select handfull of methods. I absolutely know that I am calling them correctly because they work with clients that are calling them from a DOS java mainline program. Just not within a servlet on the jboss system.
SOAP 2.2 does everything correctly and works just fine.
You can get at the message body, header, and add attachments. I know the behaviors are different in soap but at least it works.
this means the posted source code from above works? (if no: can you please post the working source code? tnx)