aspose file tools*
The moose likes Web Services and the fly likes Soap without the java objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Soap without the java objects" Watch "Soap without the java objects" New topic
Author

Soap without the java objects

George Harris
Ranch Hand

Joined: May 05, 2003
Posts: 84
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?
Philip Shanks
Ranch Hand

Joined: Oct 15, 2002
Posts: 189
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!
George Harris
Ranch Hand

Joined: May 05, 2003
Posts: 84
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?
Junaid Bhatra
Ranch Hand

Joined: Jun 27, 2000
Posts: 213
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.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Junaid Bhatra:

2) Indicate to the end-user the schema of the input and output XML messages that you expect.

Junaid, how exactly is the input/output schemas communicated to the client in this approach?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
John Hembree
hired gun
Ranch Hand

Joined: Mar 07, 2003
Posts: 250

Originally posted by George Harris:
article Why use Soap

This is a pretty good read, thanks for posting it. I've seen it implemented like this at one of the companies that I have worked with in the past. It works really good for them.
Junaid Bhatra
Ranch Hand

Joined: Jun 27, 2000
Posts: 213
Here's an example:

Here tns:MAXWORKORDER refers to a concrete element in your schema definition within the <types> section of your WSDL.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Ok. That cleared it. Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Soap without the java objects