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 Senthil_KM <Se...@infosys.com> on 2004/03/03 08:50:57 UTC
SAAJ Attchemt Part Error
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
Re: SAAJ Attchemt Part Error
Posted by Davanum Srinivas <di...@yahoo.com>.
Please attach the full stack trace and specify which version of axis u are using.
thanks,
dims
--- Senthil_KM <Se...@infosys.com> wrote:
>
> 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
>
>
=====
Davanum Srinivas - http://webservices.apache.org/~dims/