This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query on Ivan Notes

 
Abhay Agarwal
Ranch Hand
Posts: 1375
Eclipse IDE Java
  • 0
  • 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
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2169
57
Android Chrome Eclipse IDE
  • 0
  • 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: 1375
    Eclipse IDE Java
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    thanks for the detailed solution.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic