Hi
 
I am trying to add a String as an attachment to the SOAP message on the client side. I am sending it to the web servcie which is a simple echo service which takes inpur as a javax.activation.DataHandler and returns the same.
 
On the client side i use the  SAAJ apis to creat the SOAP message
 
 i get the following error when i run the client.
 
this is the snippet of the server code
------------------------------------------------------------------------

SOAPConnectionFactory soapFactory = SOAPConnectionFactory.newInstance();

SOAPConnection conn = soapFactory.createConnection();

MessageFactory msgfactory = MessageFactory.newInstance();

SOAPMessage msg = msgfactory.createMessage();

SOAPPart part = msg.getSOAPPart();

SOAPEnvelope envelope = part.getEnvelope();

SOAPBody body = envelope.getBody();

SOAPBodyElement operation = body.addBodyElement(envelope.createName("echoAttach"));

String content =

"This service is called SimpleEcho and is used for Echoing the datahandler";

DataHandler handler = new DataHandler(content,"text/plain");

==>> AttachmentPart attachment = msg.createAttachmentPart(handler);

attachment.setContentId("DESCRIPTION");

msg.addAttachmentPart(attachment);

SOAPMessage response = conn.call(msg,new URL("http://localhost:8081/axis/services/SimpleEcho"));

response.writeTo(System.out);

------------------------------------------------------------------------

==>  This is th eplace where the  error occurs
error
 
java .lang.NullPointerException at org.apache.axis.Message.creatAttachmentPart
 
Can u pls tell me how to handle this?
 
Rgds
Senthil
 
K M Senthil Kumar
Software Engineer
Software Concept Laboratory
Software Engineering Technology Labs,
Infosys Technologies Ltd Bangalore, India
Phone : +91 80 51059502
Fax : + 91 80 51102520
 

Reply via email to