Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Webservice internals

 
Ram Murthy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a beginer to WS and am working through some tutotrilas. I am using RAD to generate my service and client. The tutorials I am trying work fine but I have some questions...

1. Does WSDL get used during runtime
2. The Service bean gets mapped in the web.xml against the URL. Understand WS uses http protocol, so was curios how it works when the Service Bean does not implement HttpServlet. My understanding is when a class is mapped in servlet-class it should be a Servlet.

Thanks,
Ram
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
1. The use of the WSDL at runtime depends, as far as I understand, on what kind of client you develop.
It is possible to develop clients that assemble SOAP messages and send them without ever using the WSDL while other types of clients generates portable artifacts, like JAXB beans, at runtime, based on the WSDL. Then there is also the kind of clients which use wsimport or similar tool to generate artifacts at development time using the WSDL.
2. The fact that you see the endpoint address in the web.xml deployment descriptor is because your endpoint uses a servlet to receive requests, which are then passed on to your endpont implementation class.
Strictly speaking, this is not necessary, since the endpoint address is also present in the WSDL, so for endpoints that uses other protocols, there will be no web.xml.
Best wishes!
 
Ram Murthy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. The use of the WSDL at runtime depends, as far as I understand, on what kind of client you develop.
It is possible to develop clients that assemble SOAP messages and send them without ever using the WSDL while other types of clients generates portable artifacts, like JAXB beans, at runtime, based on the WSDL. Then there is also the kind of clients which use wsimport or similar tool to generate artifacts at development time using the WSDL.


I am genererating the client and service using RAD. The client is webproject as well, in that case does the WSDL get used at runtime. I have a feeling it does not since WSDL defines the service and using WSDL we generate the service and clients. A bunch of classes get created proxy, ser, desser etc..I am assuming these classes take care of the runtime and WSDL is not needed at runtime...atleast in my case.

2. The fact that you see the endpoint address in the web.xml deployment descriptor is because your endpoint uses a servlet to receive requests, which are then passed on to your endpont implementation class.
Strictly speaking, this is not necessary, since the endpoint address is also present in the WSDL, so for endpoints that uses other protocols, there will be no web.xml.


Where can I see the servlet(the class which extends HttpServlet) does that get generated, even then I am confused because in the web.xml the servlet-class attribute points to the service bean which is not a servlet. Once the http request is recieved it pure J2EE ...so it will invoke the service bean and find it is not a servlet. Wouldn' that lead to failure....


Also another question for those who use RAD IDE, how do I know if I am using JAX-WS or JAX-RPC ??
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding the <servlet-class> element in web.xml, check section 3.8.1 here: http://java.sun.com/blueprints/guidelines/designing_webservices/html/webservdesign9.html
 
Ram Murthy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that helped but I am not fully clear... probably let me state where my confusion..

1. In the service project on the web.xml the <servlet-class> is mapped as the service bean which is a regular java class does not extend HttpServlet. Is that allowed as per J2EE standards.

2. If yes then probably the server runtine in tandem with webservices.xml directs the httprequest to the service bean..is that a correct assumption.

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
My answers are as follows:
1. Yes.
2. Yes.

As a reference, see for instance section 10.1.2 in the JAX-RPC specification, version 1.1.
Note that the JAX-WS specification does not talk about servlet based endpoints, only about endpoints running in a servlet container. I suspect it is in order to give web service stack implementations more freedom on how to handle the implementation details.
Best wishes!
 
Ram Murthy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a bunch....I got a Halo now -
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic