• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Query on Ivan Notes

 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    thanks for the detailed solution.
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic