本文介绍了如何在现有的 Web 项目中集成 Web 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Web 服务的新手,我想将 Web 服务集成到我现有的 Web 项目中,但我很困惑如何去做.谁能告诉我怎么做?

对于我正在使用的项目:

  • Spring 框架
  • 休眠
  • 基于 Pojo(不使用 ant builder,hibernate.cfg.
  • 日蚀

假设我有包含 getTenderTitleForSecurityDeposit() 函数的 SecurityDepositServiceImpl 类,那么我如何为此做网络服务?

解决方案

实现 Web 服务的快速方法如下:

  • 确保以下 jars 可用于您的 web 应用程序:jaxws-rt.jar;jaxb-impl.jar;流缓冲.jar;政策.jar;jaxws-api.jar;stax-ex.jar;gmbal-api-only.jar;管理api.jar

  • 在您的 WEB-INF 文件夹中创建一个sun-jaxws.

  • 在您的 web.

 <listener-class>com.sun.<servlet-mapping><servlet-name>WebServices</servlet-name><url-pattern>/ws/*</url-pattern></servlet-mapping>

  • 创建您的类 com.foo.ws.MyWebServiceClass 并注释您喜欢提供的内容:

@WebService(serviceName="MyServices")公共类 MyWebServiceClass 扩展 SpringBeanAutowiringSupport {@WebMethod公共列表myMethodExposed(字符串用户名){列表toret = new ArrayList();toret.add("你好世界");toret.add("美丽人生");返回 toret;}}

等等:您的网络服务已准备就绪.

I am new to Web-Services, I want to integrate Web-service in my existing web project, but I am confused how to do it. Can any one tell me how to do it?

For my project I am using:

  • Spring Framework
  • Hibernate
  • Pojo based (not using ant builder, hibernate.cfg.
  • Eclipse

Suppose I have SecurityDepositServiceImpl class that contain getTenderTitleForSecurityDeposit() function, then how I do web-service for that?

解决方案

A quick way to implement a web service is the following one:

  • Be sure that the following jars will be available to your webapp:jaxws-rt.jar; jaxb-impl.jar; streambuffer.jar; policy.jar; jaxws-api.jar; stax-ex.jar; gmbal-api-only.jar; management-api.jar

  • Create a "sun-jaxws.

  • Add in your web.

  • Create your class com.foo.ws.MyWebServiceClass and annotate what you like to provide:

et voila: your web service is ready.

这篇关于如何在现有的 Web 项目中集成 Web 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 06:16
查看更多