File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Soap & attachments: encoded or literal?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Soap & attachments: encoded or literal??" Watch "Soap & attachments: encoded or literal??" New topic
Author

Soap & attachments: encoded or literal??

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,
I would like for a ws client to retrieve an image from a ws endpoint. I am totally confused as to how to what encoding style to choose as well as how to implement it.

Here is the code for the client:



Here is the code for the endpoint:



If I choose documentliteral it will not compile and give me the following error message:
**************
Attachment types are not supported in literal mode - Type: "javax.activation.DataHandler"
**************

If I choose nothing (which defaults to encoded in Netbeans) It does compile but when I test the operation, I get this from JBOss 4.0.4:



I use Netbeans 5.0 and JBoss 4.0.4.

Can anyone help?

Julien.
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2057
Hi Julien, can you post the wsdl and the service endpoint interface?
[ May 27, 2006: Message edited by: Jesus Angeles ]
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Yep,

Nikhil Goel
Ranch Hand

Joined: Jul 11, 2003
Posts: 32
Julein ,

Have a look https://jax-rpc.dev.java.net/whitepaper/1.1.2/attachments-howto.html

This is exactly what you are looking for .

Hope it helps.

-nikhil
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,

Thanks for the tip. I had a look at the article and here is what I tried to do:

I use a handler in order to attach the image. Whether I attach the attachment from within the service implementation or a handler is the same. Here is my handleResponse method:



Then I try to recover the attachment in the client using pretty much the same way as in the article:



This always yields a nullpointerexception on the collection object.

Can anyone tell me why??

Thanks in advance,

Julien.
 
 
subject: Soap & attachments: encoded or literal??