axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Senthil_KM" <Senthil...@infosys.com>
Subject RE: SAAJ Attchemt Part Error
Date Wed, 03 Mar 2004 11:41:20 GMT
Hi Luciano,
 
Thanks for the timely helo. But i found out the exact cause of my
problem.I had placed only the activation.jar in the classpath
Even the mail.jar need to be placed in the class path for it to work

  _____  

From: luciano.fiandesio@ecb.int [mailto:luciano.fiandesio@ecb.int] 
Sent: Wednesday, March 03, 2004 4:42 PM
To: axis-user@ws.apache.org
Subject: RE: SAAJ Attchemt Part Error



Hi, 
I think that there is something wrong in your code: 

> String content = 
> "This service is called SimpleEcho and is used for Echoing the 
> datahandler"; 
> DataHandler handler = new DataHandler(content,"text/plain"); 

You cannot pass a String in the constructor. 
You should use something like: 

DataSource ds = new
org.apache.soap.util.mime.ByteArrayDataSource(conetnt 
                                .getBytes(),
"application/octet-stream"); 
DataHandler d = new DataHandler(ds); 

Hope this help, 
Luciano 


-----Original Message----- 
From: Senthil_KM [mailto:Senthil_KM@infosys.com] 
Sent: Wednesday 03 March 2004 11:27 
To: axis-user@ws.apache.org; dims@yahoo.com 
Subject: RE: SAAJ Attchemt Part Error 



HI Dims, 

Stack trace : 

java.lang.NullPointerException 
        at 
org.apache.axis.Message.createAttachmentPart(Message.java:620) 
        at samples.test.eg1.SaajClient.main(SaajClient.java:42) 
Exception in thread "main"  

The libne 42 is the line : AttachmentPart attachment = 
message.creatAttachmentPart(); 

And I am using AXIS 1.1 version! 

 I have also attached the activation.jar file in the claspath. 

Rgds 
Senthil 

-----Original Message----- 
From: Davanum Srinivas [mailto:dims@yahoo.com] 
Sent: Wednesday, March 03, 2004 3:50 PM 
To: axis-user@ws.apache.org 
Subject: Re: SAAJ Attchemt Part Error 

Please attach the full stack trace and specify which version of axis u 
are using. 

thanks, 
dims 

--- Senthil_KM <Senthil_KM@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/ 

 

Any e-mail message from the European Central Bank (ECB) is sent in good
faith but shall neither be binding nor construed as constituting a
commitment by the ECB except where provided for in a written agreement.
This e-mail is intended only for the use of the recipient(s) named
above. Any unauthorised disclosure, use or dissemination, either in
whole or in part, is prohibited.
If you have received this e-mail in error, please notify the sender
immediately via e-mail and delete this e-mail from your system.



Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message