It's not a secret anymore!*
The moose likes Servlets and the fly likes Calling a web service operation from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling a web service operation from a servlet" Watch "Calling a web service operation from a servlet" New topic
Author

Calling a web service operation from a servlet

Alex Parvan
Ranch Hand

Joined: Dec 10, 2009
Posts: 115
Hi, i wanted to ask this...

I have a servlet and web service on the same server, and i want to call a WS operation from the servlet.
How do i do this ?

Thanks,
Alex


"Quoting yourself is stupid" - Me
Chinna Eranna
Ranch Hand

Joined: Dec 08, 2009
Posts: 174

You have to write a Client depending on the type of webservice (Soap/REST).


- Chinna
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
If you can guarantee that they will always be on the same server, then you can factor out the business logic from the WS into their own classes, and then use those classes directly from within the servlet.


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calling a web service operation from a servlet
 
Similar Threads
Pizza and Servlets
web servirce help
Web Service question - Need your suggestion.
How to call a web service from a servlet........
.NET service consumption from Java servlet