I take part in an SOA project where I have to create, test and deploy web services based on WSDL files supplied by a partner Co. We use Apache Axis 1.2. ( http://ws.apache.org/axis ) Recently I ran into a problem with one of the services which has an attachment as part of the request message. It is a "docment/literal" service by wsdl definition. I generate the java classes using wsdl2java. The service interface has 2 arguments - an object which holds information about the file being attached, and an org.apache.axis.attachments.OctetStream object, which is the attachment itself. When I invoke the service using the generated JUnit testcase, I keep getting a SAXException like "Invalid element in com.xyz.MyClass - myClass". This is an exception thrown by Axis BeanDeserializer at the server side.
Every thing magically starts working as soon as I change the binding style in wsdl to "RPC" instead of "document". Even if I first generate the code using wsdl with style="document" and then just change the style in server-config.wsdd to "style=RPC" at the time of deployment, it still works fine.
Is a document style web service allowed to have only one argument in the corresponding implementation java class? Is it failing because I have 2 arguments in there? I am basically seeing that the BeanDeserializer goes for a toss when deserializing the incoming request message. I intercepted the outgoing request at the client side and incoming request at the server side using Axis handlers. They look fine to me. Besides, the fact that the deserialization works when I change server-config.wsdd to "style=RPC" baffles me. I am attaching the files I used.