spring 发布 Jax-Ws Service (一)
1、maven依赖:
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
</dependency>
2、编写需要发布的JavaBean
import javax.jws.WebMethod;
import javax.jws.WebService; import org.springframework.stereotype.Component; @Component
@WebService(serviceName = "myService")
public class HolidayEndpoint { @WebMethod
public String say(String name) {
return "hello,"+name;
} }
3、配置 web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
4、Spring的配置文件beans.xml
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="baseAddress" value="http://localhost:8081/services/"/>
</bean>
服务器:tomcat 端口号:8081
wsdl:http://localhost:8081/services/myService?wsdl
说明及注意
(1)、通过http://localhost:8081/services/myService?wsdl 访问webservice部署描述符
还有自动生成的xsd:http://localhost:8081/services/myService?xsd=1 。
(2)、@SOAPBinding(parameterStyle=ParameterStyle.WRAPPED)
必须添加,否则会报错;另外,如果发布的方法只有一个参数可以使用@SOAPBinding(parameterStyle=ParameterStyle.BARE)。
(3)、@WebService(serviceName = "myService") 服务名称与Spring配置的bean一致。
(4)、webservice的端口设置不要与服务器一样,这一点非常重要否则服务器应用与webservice服务冲突会产生HTTP404错误。
spring 发布 Jax-Ws Service (一)的更多相关文章
- 构建一个基于 Spring 的 RESTful Web Service
本文详细介绍了基于Spring创建一个“hello world” RESTful web service工程的步骤. 目标 构建一个service,接收如下HTTP GET请求: http://loc ...
- 使用Apache CXF和Spring集成创建Web Service(zz)
使用Apache CXF和Spring集成创建Web Service 您的评价: 还行 收藏该经验 1.创建HelloWorld 接口类 查看源码 打印? 1 package ...
- 使用CXF+Spring发布WebService,启动报错
使用CXF+Spring发布WebService,启动报错,日志如下: 五月 12, 2017 9:01:37 下午 org.apache.tomcat.util.digester.SetProper ...
- 【Java Web开发学习】Spring发布RMI服务
[Java 远程服务]Spring发布RMI服务 转载:https://www.cnblogs.com/yangchongxing/p/9084066.html RmiServiceExporter可 ...
- [SDK2.2]Windows Azure Cloud Service (35) 使用VS2013发布Azure Cloud Service
<Windows Azure Platform 系列文章目录> 好久没有更新BLOG了,今天我们继续Windows Azure相关的内容. 笔者最近把Visual Studio升级到了20 ...
- spring发布和接收定制的事件(spring事件传播)
spring发布和接收定制的事件(spring事件传播) 2012-12-26 20:05 22111人阅读 评论(2) 收藏 举报 分类: 开源技术(如Struts/spring/Hibernat ...
- 解决cxf+spring发布的webservice,types,portType和message以import方式导入
用cxf+spring发布了webservice,发现生成的wsdl的types,message和portType都以import的方式导入的.. 原因:命名空间问题 我想要生成的wsdl在同个文件中 ...
- 如何创建和发布.asmx Web Service
创建和发布Web ServiceWeb服务方法中可以返回一个DataSet对象 WEB服务可以说是下一代WEB应用程序的基础,无论客户端是WINDOWS应用.ASP.NET Web Form程序.甚至 ...
- [翻译]Spring MVC RESTFul Web Service CRUD 例子
Spring MVC RESTFul Web Service CRUD 例子 本文主要翻译自:http://memorynotfound.com/spring-mvc-restful-web-serv ...
- spring发布RMI服务(-)
spring发布RMI服务 最近交流了一个项目,需要从RMI.WebService.接口文件中采集数据到大数据平台,下面自己测试了通过Spring发布RMI服务. 说明:RMI服务要求服务端和客户端都 ...
随机推荐
- thymleaf 常用th 标签
常用th标签都有那些? 关键字 功能介绍 案例 th:id 替换id <input th:id="'xxx' + ${collect.id}"/> th:text 文本 ...
- 常见C++内存池技术
原文:http://www.cppblog.com/weiym/archive/2013/04/08/199238.html 总结下常见的C++内存池,以备以后查询.应该说没有一个内存池适合所有的情况 ...
- Logback的配置和使用(终极)
1.logback介绍 logback是由log4j创始人设计的又一个开源日志组件.logback当前分成三个模块:logback-core,logback-classic和logback-acces ...
- iOS: 详细的正则表达式
一.简单的正则规则 1.由数字.26个英文字母或者下划线组成的字符串: ^[-9a-zA-Z_]{,}$ 2.非负整数(正整数 + 0 ): ^/d+$ 3. 正整数: ^[-]*[-][-]*$ 4 ...
- HTTPS服务器配置
一.SSL证书申请 1.确认需要申请证书的域名 2.生成私钥和csr文件 在linux机器上执行以下命令生成私钥 #openssl genrsa -out server.key 2048 在linux ...
- Android -- Activity的销毁和重建
两种销毁 第一种是正常的销毁,比如用户按下Back按钮或者是activity自己调用了finish()方法: 另一种是由于activity处于stopped状态,并且它长期未被使用,或者前台的acti ...
- JS-获取图片地址
var url=document.getElementById("a001").src; 或var url=document.getElementById("a001&q ...
- 学生表 课程表 成绩表 教师表 50个常用sql语句
原文:http://www.cnblogs.com/zengxiangzhan/archive/2009/09/23/1572276.html Student(S#,Sname,Sage,Ssex) ...
- C#基础视频教程7.2 如何编写简单游戏
前面一小节我们实现了简单的碰撞检测,但是实际上游戏的对象并不是一个标准的矩形(小鸟是一个不规则的物体,其实碰撞的管道也是不规则物体),所以如果真的要做的比较完美,我们自己要写一个方法,能够导入一个图像 ...
- Matlab矩阵基本操作(定义,运算)
转自:http://blog.csdn.net/perfumekristy/article/details/8119861 一.矩阵的表示在MATLAB中创建矩阵有以下规则: a.矩阵元素必须在”[ ...