tags:

views:

466

answers:

1

I'm completely stuck and need your help... I've created a webservice stub with jaxb 2.x for a service that sends a binary file (base64 encoded jpg images) within a soap message. Everything worked fine and I was able to receive and display the images, until I tried to export the eclipse RCP app to a product, which caused imediatly LinkageErrors (as usual, javax.xml.namespace.QName and some more).

I was able to solve that problem to 'rebundle' axis2 and now everything works fine again - except the parsing of the binary file part within the stub, which now causes an exception (unexpected element).

A closer look revealed, that the reader (OMStAXWrapper), that is used in the axis2-jaxb-generated Stub, now does not read the whole base64 text but only the first 10000 bytes. Then it doesn't find the correct ending of the element and throws an exception.

As mentioned before - this didn't happen in the beginning, so I hope it's just a parameter or an option. Big thanks in advance for every help or hint!

Edit It wasn't JAXB, I used JAXWS and wsimport to create the stub for the wsdl file...

+1  A: 

For a bit of background, OMStAXWrapper is part of Axiom, which is Axis2's custom streaming utility for web services, which Axis2 uses as a replacement for SAAJ. I wouldn't be hugely surprised if it was buggy, if my prior experience with Axis is anything to go by.

If you want to send large binaries over SOAP, the best technology for this at the moment seems to be MTOM (see here for how to use it with Axis2). This can better optimize the binary representation, and your problem might go away. However, both client and server must be able to speak MTOM, so it may not be an option for you.

Alternatively, it should be possible to convince Axis2 to use the standard SAAJ API instead of using Axiom. SAAJ is slower, but should be less buggy.

My final suggestion is to abandon Axis2 for your client, and use something more lightweight. Spring-WS provides a very nice client API, which is currently my tool of choice for talking to remote web services. It supports Axiom and SAAJ, as well as MTOM, and it sufficiently lightweight that it's quite easy to find out why something's gone wrong.

skaffman
Thanks for your answer - unfortunatly I've no control over the service provider and can't switch to MTOM... I've the feeling that HTTP_CLIENT_STREAMING_CHUNK_SIZE is now set to 10k and the underlying XMLStreamReader can't send the 250k binary data at once which troubles the generated Service Stub...!?
Andreas_D
That's possible, yes. In your position, I'd try Spring-WS instead. I have no experience with Axis2, I'm afraid.
skaffman