aspose file tools*
The moose likes Websphere and the fly likes How to call a web service from a servlet........ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "How to call a web service from a servlet........" Watch "How to call a web service from a servlet........" New topic
Author

How to call a web service from a servlet........

karthik mama
Ranch Hand

Joined: Aug 27, 2007
Posts: 34
Hi All,
i am actually new as to how can we call a web service from a servlet/jsp. I could do the same from a client but not from a servlet can anyone please help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42610
    
  65
A servlet can run the very same code you're using from a client (by which I assume you mean a desktop Java app). What problems are you encountering? (Please never, ever, do this kind of thing in a JSP.)


Ping & DNS - my free Android networking tools app
karthik mama
Ranch Hand

Joined: Aug 27, 2007
Posts: 34
Hi
I am using RAD 7 and the server is WAS 6.1.

I need to send the form details to the servlet from where in i need to create a bean based on those form details. then invoke a service on that bean get the response back then present it.

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42610
    
  65
What is "a bean" in the context of WS? Which WS toolkit are you using? Most toolkits come wth tools to create client code for a WS given by a WSDL.
karthik mama
Ranch Hand

Joined: Aug 27, 2007
Posts: 34
yes for a WS client code is automatically generated. But the thing is without the help of the client generated i need to invoke the WS from a servlet after getting the form parameters leave aside 'bean' a mistype
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42610
    
  65
Well, you need some code to invoke the WS - why not use the code generated by whichever toolkit you're using?
karthik mama
Ranch Hand

Joined: Aug 27, 2007
Posts: 34
The code generated automatically is through SOAP messages and what i need is the code for a servlet where in i can invoke a WS...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to call a web service from a servlet........