This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Web Services and the fly likes how does stub work ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "how does stub work ?" Watch "how does stub work ?" New topic

how does stub work ?

laxmikant upadhyay

Joined: Aug 24, 2012
Posts: 14
i have created a simple web service and client using wsdltojava tool of Axis2 with available wsdl file . At the client side i just invoked the method of stub, that's it.. and it work fine.
But i don't understand how it identifies the endpoint?
How the connection is being created to server?
how actually marshaling is being done ??
please put some light on it.
J Dirksen

Joined: Sep 04, 2012
Posts: 13
That's the advantage of using WSDL2Java. In the WSDL the endpoint where the service is running on is defined. So if you generate a client from this WSDL the default configuration, usually, is that the endpoint from the WSDL is used as default. So that's how axis knows where to send the message to.

The mapping to and from XML is also generated from the WSDL. Depending on the configuration with Axis2 this will be either done using adb or jaxb. What this does it uses the annotated generated classes from the WSDL and uses that information to map from XML to Java and back again.

I don't know the dependencies axis has, but it probably uses the default Java URL connection to make the connection with the server. Since SOAP is just plain XML over HTTP there is usually no need for additional frameworks for creating this connection and invoking the endpoint.
laxmikant upadhyay

Joined: Aug 24, 2012
Posts: 14
hi Dirksen,
thank you so much for your quick and useful reply ....
I agree. Here's the link:
subject: how does stub work ?
It's not a secret anymore!