开发者

How to create a jsp web form to post data to the web service and display result from the web service

开发者 https://www.devze.com 2023-01-28 08:20 出处:网络
I am using Eclipse and Tomcat server for developing a web application with Web Services. When I test the web service, I get :

I am using Eclipse and Tomcat server for developing a web application with Web Services.

When I test the web service, I get :

"Hi there, this is an AXIS service! Perhaps there will be a form for invoking the service here..."

The IDE does provide a facility to create a test web c开发者_Go百科lient for testing the web service.

However, I want to write my own JSP page from scratch to consume this web service...

Please provide me some sample code / related links.

Thanks in advance.


You can do it in following pattern :

1.Create a form in jsp to take input data.
2.Retrieve those data from servlet.
3.Make a call to webservice using client generated from WSDL and send response back to jsp.

Addition of a new layer that will interact with service would be an better design


Hope this would help.

1.Download the wsdl file related to webservice.

2.Generate clients using wsdl2java command [ You can find this in Axis2 or Apache CXF )

  1. Include all generated client code,in your class path

  2. Post the data from your jsp to the servlet which includes generated client code to make webservice request

0

精彩评论

暂无评论...
验证码 换一张
取 消