Jax-WS attachments puzzle

M

mchristyuk

Hi everyone,

I was hoping somebody could shed some light on a puzzling issue I have
doing attachments with Jax-WS.

The scenario is that I send a file to a service as an attachment.. the
service processes the file.. then at a later date I call the service
again to get the processed file back.

I am using Java 6, Netbeans 6 and Sun App Server 9 (bundled with
Netbeans 6) as my platform.

Now my problem is that I can send attachments fine from the client to
the service.. however when ever I put an attachment on a response from
a service it never gets back to the client. The response arrives but
with no attachments.

When I send from the client to the service I get a context from a
BindingProvider, put in a DataHandler and add this to the context as
an OUTBOUND_MESSAGE_ATTACHMENTS type.. this arrives at the service and
I can get my attachments from the WebServiceContext object and they
are there as INBOUND_MESSAGE_ATTACHMENTS.

I thought that to send a file as an attachment back to the client I
would do a very similar thing.. except instead of using the
BindingProvider I just use the WebServiceContext. I go through exactly
the same process.. however my message received at the client has no
attachments.

I'm tearing my hair out over this one.. is there something silly I'm
missing? I've searched on Google high and low but all the posts I see
are about client to service.. not service to client..

I am getting no errors exceptions either..

Help!.. what am I doing wrong? Is the WebServiceContext only
applicable to incoming calls and therefore I need to create something
else for a response call?

Many Thanks

Mark Christy
 
M

mchristyuk

Just to follow up with some more information..

I put a monitor on the wire to see what the request and responses were
coming out of the client/service. The client request shows the
attachment however the server response has none.

Therefore I'm pretty confident its all going wrong at the service
end.. I'm putting my attachment DataHandlers into the current
WebServiceContext and sending my reply back.. they just don't seem to
be there..

Cheers

Mark
 
M

mchristyuk

Well for those interested in a solution I have it.. though it makes no
sense to me at all!

I created an empty SOAPHandler which does absolutely nothing..

However this made the service work perfectly in returning files as
attachments!.. removing the empty SOAPHandler stops the service
returning attachments..

Very confused.. but it works.. so I'm happy..

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top