…have been banging my head against this for last 2 days…I had got it working but something is messed up. I’ve looked up all the documentation and samples and I think I’m doing it right; Please tell me what is it that I’m doing something wrong.

 

I’m trying to pass attachments back and forth between a client and server. The attachment from the client to the server just works fine. But the other way round just wouldn’t work. Here’s the code snippet of my SOAP service:

 

          P.S.: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><PolledData/>" will be replaced by actual data later, this is just for testing.

           

ByteArrayDataSource ds = new ByteArrayDataSource("<?xml version=\"1.0\" encoding=\"UTF-8\"?><PolledData/>", "text/xml");

      ds.setContentType("UTF-8");

      DataHandler dh = new DataHandler(ds);

      MimeBodyPart attachementFromServer = new MimeBodyPart();

      attachementFromServer.setDataHandler(dh);

      attachementFromServer.setContent(ds.getText(), "text/xml");

 

      ctx.addBodyPart(attachementFromServer);

 

And ctx is SOAPContext that I get as a first parameter to my soap service.

 

Guys, I’m suppose to be giving a demo on SOAP attachments at 4 and my code breaks this afternoon. Any help would be really appreciated.

 

Thanks and hoping to hear from you all soon.

 

~Gayatri

(Am I sounding desperate or what?)

 

 

Reply via email to