This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Invoking WebService from a Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Invoking WebService from a Servlet" Watch "Invoking WebService from a Servlet" New topic
Author

Invoking WebService from a Servlet

Vidya Sankar
Greenhorn

Joined: Aug 17, 2005
Posts: 20
Hi,
I have written a web service using the JAX-WS 2.0 Reference Implementation from sun and I have deployed it on tomcat. I want to invoke this webservice from a servlet. Can anyone please outline the steps to achieve this.

Thank You.


SCJP 1.4
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41015
    
  43
Invoking a web service from a servlet isn't any different from invoking it from any other client (e.g. a standalone desktop app). Are you encountering specific problems caused by the servlet environment?


Ping & DNS - my free Android networking tools app
Vidya Sankar
Greenhorn

Joined: Aug 17, 2005
Posts: 20
Hi,
I kind of realised after I just put the jaxb generated client artifacts in the classes folder of the war file. But I was a little confused with an example in the Richard Monson book abt the jax-rpc 1.1 style with the generated stub model where he was actually giving jndi references to the services being invoked.

Though I am still not very clear with the DII. Anyway thank you for the reply.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2919
    
    5
Originally posted by Vidya Sankar:
But I was a little confused with an example in the Richard Monson book abt the jax-rpc 1.1 style with the generated stub model where he was actually giving jndi references to the services being invoked.


Those JNDI references refer to the <service-ref> in the web.xml file. Basically in a servlet the stub should be configured and accessed via the <service-ref> deployment descriptor - it should not be configured programmatically. For more details on the <service-ref> deployment descriptor see:
JSR-000154 Java Servlet 2.4 Specification
SRV.13.4 Deployment Descriptor Diagram
page 147 23. service-ref Element

Also see RMH J2EE WS 22.5 Service References (page 677).
[ March 11, 2006: Message edited by: Peer Reynders ]
Vidya Sankar
Greenhorn

Joined: Aug 17, 2005
Posts: 20
Thank You.
 
 
subject: Invoking WebService from a Servlet
 
Similar Threads
trivial question
Flex 3 with Java
JAX-RPC client side programming
Invoking a webservice from a servlet
Using different Content Types for REST Webservices