This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Currently we are using Axis to receive soap requests. Axis then converts the soap xml into java objects. My question is, is there any way to get the Dom(xml) object from Axis? I want to use Soap so I can publish the wsdl, but I don't want the overhead of the java objects. Should I just create my own servlet and bypass Axis?
I see a possible clue in the Axis User's Guide. Here is an excerpt from the section "Newbie Tips: Finding Your Way Around": org.apache.axis.SOAPEnvelope As you can see, starting with the MessageContext lets you work your way down through the API, discovering all the information available to you about a single request/response exchange. A MessageContext has two Messages, which each have a SOAPPart that contains a SOAPEnvelope. The SOAPEnvelope, in turn, holds a full representation of the SOAP Envelope that is sent over the wire. From here you can get and set the contents of the SOAP Header and the SOAP Body. See the Javadocs for a full list of the properties available.
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
Joined: May 05, 2003
To clarify my question. Is it possible to use something like Axis, Cape Clear or any of the other soap applications without having to deserialize the xml on the server side. On the client side, I was able to use org.apache.axis.Message to access the soap parts, but the server classes were all new objects (no access to the dom tree). I just finished reading the article Why use Soap and I think this might be the correct solution. No soap just HTTP + XML. But are you still able to publish a WSDL if you don't use soap?
We had the exact same requirement and here's the apporach we took: Publish our services in AXIS via the "message-style" service that AXIS offers. Basically you hand-write the WSDL, which contains the schema definitions of the message parts, and you publish this as a document/literal type of webservice. Within AXIS, you specify the style of the webservice as "message", and point it to your custom WSDL:
The method signature looks like:
Here the entire contents of the <SOAP-BODY> is handed to your method as a DOM Document object. AXIS allows 4 method signatures for message-style service(read the document for that). Using this approach we accomplish the following things: 1) Pass around XML messages within SOAP without the overhead of XML/Java Object data-binding. 2) Indicate to the end-user the schema of the input and output XML messages that you expect. Note that for message-style webservices, AXIS hands you the entire SOAP-Body, it does not convert them to Java objects, neither does it do any schema validation (it's up to you to do that) Hope that helps.