This is my first experience with webservices. So need a little help here. We are supposed to write a client program to consume the webservice. I find some difficulties in understanding certain concepts, any help appreciated !
1. I now understand what is a webservice, and little googling has helped me to understand that 'Axis' is a SOAP implementation. We have many such implementations. So Axis helps in 'hosting' a webservice.
But what is JAX-WS? Is it like another SOAP implementation or Axis in turn uses JAX-WS to implement SOAP ?
2. Currently we are creating 'stubs' to call the webservice, the stubs were created using the WSDL2JAVA tool, so if we have a WSDL file can we create 'stubs' for any webservice which is hosted by a different SOAP implementation engine? Say for eg, if we have a webservice which is hosted using some SOAP engine other than axis, then can i use this WSDL2JAVA command to generate stubs for it and call methods on the stubs? Do we have any other tool like WSDL2JAVA to generate stubs? Can stubs be generated only for certain type of webservices or can be stubs be generated only if the webservice provider 'allows' us to do so?
3. If I call a webservice using stubs, it is just like calling a method on a local object.So where are we using JAX-WS in the client code? Do we have any types of webservice? Say if a webservice is implemented on axis, can i know that as a client?
4. In our case, after we created stubs, we were presented with a spec which contained details on which object to instantiate and what methods to call? If we are not provided with such spec then can we determine what objects to instantiate and call methods by interpreting the WSDL ?
1. JAX-WS is a web service API.
JAX-WS is also a standard, stipulating what a web service stack should make available.
The reference implementation is Metro - available here: http://jax-ws.java.net/ 2. Stubs can be generated for SOAP web services that make a WSDL available.
The WSDL also needs to adhere to certain rules; for example JAX-WS only supports RPC/Literal and Document/Literal and no other encoding styles.
3. The web service stack is used by the stubs.
4. Yes, the WSDL should be sufficient to generate stubs. However, the WSDL, without additional documentation, does not convey the semantics of the web service.
The additional documentation may be included in the WSDL for human consumption.
Thanks for the reply. It was really helpful. I have a couple of questions though,
1. Can a client find out what SOAP implementation the calling webservice is using?
2. If a webservice is deployed using Axis then can I use wsimport to generate stubs? If the service uses JAX-WS then can i use wsdl2java to generate the stubs?
BTW I have downloaded your notes on Webservice from slideshare, thank you so much !
posted 8 years ago
1. No, unless the web service enclose some information about this.
2. You can use wsimport to generate stubs provided that the web service publishing the WSDL only use features supported by JAX-WS.
Some old JAX-RPC service use a type of encoding that JAX-WS does not support. This will cause problems with JAX-WS clients.
Disclaimer: I do not know much about Axis, since I tend to choose other web service stacks.