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服务要求服务端和客户端都 ...
随机推荐
- PTC点击网赚入门
第一次接触PTC大概是11月19号左右,那时候第一感觉是"这不就是传销吗,肯定是骗人的",但是由于利润十分之大,又忍不住仔细研究了一下,我还是十分还是十分谨慎的,再加上程序员的头脑 ...
- AlphaGo:用机器学习技术古老的围棋游戏掌握AlphaGo: Mastering the ancient game of Go with Machine Learning
AlphaGo: Mastering the ancient game of Go with Machine Learning Posted by David Silver and Demis Has ...
- 关于从SVN检出项目后,项目名称还是之前修改之前或者项目名称不对问题
找到工作空间Workspaces/项目名称/.projet 修改文件中<name>项目名称</name>属性即可
- PHP接收跨域请求header 头设置
header("Access-Control-Allow-Origin: http://a.com"); // 允许a.com发起的跨域请求 //如果需要设置允许所有域名发起的跨域 ...
- Pairwise
FCC题目:找到你的另一半 有一个能力数组[7,9,11,13,15],按照最佳组合值为20来计算,只有7+13和9+11两种组合.而7在数组的索引为0,13在数组的索引为3,9在数组的索引为1,11 ...
- Java经典23种设计模式之行为型模式(三)
本文接着介绍11种行为型模式里的备忘录模式.观察者模式.状态模式. 一.备忘录模式 在不破坏封装性的前提下,捕获一个对象的内部状态.并在该对象之外保存这个状态.这样以后就能够将该对象恢复到原先保存的状 ...
- nDCG学习笔记
参考:http://en.wikipedia.org/wiki/Discounted_cumulative_gain Normalized Discounted Cumulative Gain:一种对 ...
- HDU1004——Let the Balloon Rise
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- poj 2406 Power Strings KMP匹配
对于数组s[0~n-1],计算next[0~n](多计算一位). 考虑next[n],如果t=n-next[n],如果n%t==0,则t就是问题的解,否则解为1. 这样考虑: 比方字符串"a ...
- ACM 刷题错误总结 持续更新并持续回想中o(╯□╰)o
一.段错误/RE 1.& 变量取地址 2.数组越界 3.爆栈, 非常可能是死循环,ruturn的边界没有处理好,或者是递归的内容里有死循环的部分. 4.线段树 逢写必错,都是build(i*2 ...