permaculture playing cards*
The moose likes JSP and the fly likes Calling web services from Spring application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Calling web services from Spring application" Watch "Calling web services from Spring application" New topic
Author

Calling web services from Spring application

megha Ranjan
Greenhorn

Joined: Jul 28, 2011
Posts: 10

I need to know how do we integrate servlets/jsp with restful web services. Please help. Using spring3.0,jibx and eclipse.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
What do you mean by "integrate"? JSPs have nothing to do with web services. Servlets are generally used for implementing web services, but the WS framework does that, you wouldn't have to write a servlet.
megha Ranjan
Greenhorn

Joined: Jul 28, 2011
Posts: 10

Tim Moores wrote:What do you mean by "integrate"? JSPs have nothing to do with web services. Servlets are generally used for implementing web services, but the WS framework does that, you wouldn't have to write a servlet.


I mean i have developed one web service and now i want to call that web service on click of button from a jsp page. How can that be achieved using spring.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Not sure what Spring has to do with this - are you using some WS library that's related to Spring? If so, there's probably a page that lists all available WS and their URLs; the documentation should tell you where to find that.

Then you'd use the URL of that service in your HTML/JSP page (maybe as the action attribute of a form that gets submitted at the click of a button).
Pankaj Kumarkk
Ranch Hand

Joined: Apr 17, 2011
Posts: 108
You basically have to write a web service client.
If you want to call as web service from click of a button on a jsp then below is what you would have to do:
1. Write a jsp page which takes in input parameter for the web service method
2. Write a servlet to recieve the request from the jsp and get all the input parameters
3. Generate the web service client side artifacts
4. Call the web service using the client proxie. This code for calling can be written in the servlet itself
5. Recieve the response from web service. Use that response to populate the result jsp

I do not know if spring provides all of this automatically. These are the steps you would need to do to invoke a web service from a jsp.

PS: Calling a web service from a jsp makes sense only if you are consuming web services in your web application.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

At this point, the OP already has written the web service using Spring. He just wants to call a web service from a button on the JSP page, so actually, this isn't a Spring questions. This is just a simple. What is the URL for the web service and call it from the button on the page.

I am moving this back to the JSP forum. Which I am assuming is where it originated.

Thanks and good luck.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling web services from Spring application
 
Similar Threads
JNLP?
anybody plans to take BEA SOA Enterprise Architecture?
Communication of servlets in different JVM's
Technologies which have a good scope
Is any one working on SOA based projects?