Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Query on Ivan Notes

 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading Ivan notes. I am on page 269. Topic is Servlet-Based Web Service Configuration Example



The web service implementation bean declaration and instance variable declarations:



Now in web.xml deployment descriptor, HelloWorldWS class is configured as Servlet



I guess we need to either extend HelloWorldWS class with HttpServlet class OR annotate it with HttpServlet (as per new Servlet version 3.0). In the given code, none of this is done.
So is this web.xml file mapping is incorrect ?

thanks
 
Creator of Enthuware JWS+ V6
Posts: 3288
296
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Abhay Agarwal wrote:
I guess we need to either extend HelloWorldWS class with HttpServlet class OR annotate it with HttpServlet (as per new Servlet version 3.0). In the given code, none of this is done.
So is this web.xml file mapping is incorrect ?


This the old way of creating a WebService as a Servlet-based endpoint. It needs the webservices.xml in combination with the web.xml. Did you include the webservices.xml deployment descriptor?

You can read more about it in the JSR-109:

5.3.2.1 javax.jws.WebService annotation
For Servlet based endpoints using this annotation, fully qualified name of the Service Implementation Bean class must be used as the <servlet-link> element in the deployment descriptor to map the Port component to the actual Servlet.
Following default mapping rules apply for Web modules that contain Servlet based endpoints that use this annotation but do not package a web.xml or a partial web.xml:

  • fully qualified name of the Service Implementation Bean class maps to <servlet-name> element in web.xml.
  • fully qualified name of the Service Implementation Bean class maps to <servlet-class> element in web.xml (also specified in section 7.1.2)
  • serviceName attribute of javax.jws.WebService annotation prefixed with "/" maps to <url-pattern> element in web.xml. If the serviceName attribute in javax.jws.WebService annotation is not
    specified, then the default value as specified in JSR-181 specification is used.


  • Regards,
    Frits
     
    Abhay Agarwal
    Ranch Hand
    Posts: 1376
    Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    thanks for the detailed solution.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!