操作步骤:
1。用eclipse创建动态的web工程
2。将spring 的applicationContext.xml和spring2.0.jar加入到工程中
3。新建一个类:
public class PayActivityService extends ServletEndpointSupport{
public static final Log log = LogFactory.getLog(PayActivityService.class);
public String queryPayActivityList(String number,String date) {
List<PayActivity> payActivityList = null;
try {
payActivityList = ((PayActivityBiz)super.getWebApplicationContext().getBean("payActivityBiz")).payActivityList(number,date);
log.info(payActivityList.size());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("<xml>");
if(payActivityList != null){
for (PayActivity payActivity : payActivityList) {
stringBuffer.append("<time>"+payActivity.getHappenDate()+"</time>");
stringBuffer.append("<payMethod>"+payActivity.getActivityType()+"</payMethod>");
stringBuffer.append("<price>"+payActivity.getTransactionPrice()+"</price>");
stringBuffer.append("<result>"+payActivity.getTransactionResult()+"</result>");
}
}
stringBuffer.append("</xml>");
return stringBuffer.toString();
}
}
4。在类上鼠标右键new Web Service
此操作自动生成server-config.wsdd,deploy.wsdd,undeploy.wsdd,web.xml(向其中添加内容)
5。在web.xml中加入spring的监听器
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener><listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
6。启动工程,编写测试代码
注:本人用的工具 eclipse eclipse_j2ee_europa
分享到:
相关推荐
spring mvc集成webservicedemo
使用最新的CXF2.7和Spring3的 Java WebService 集成用例 应用Spring Annotation
在做四川电信项目时搭建的一个webservice集成spring的服务端框架,里面有服务端的实现,运行后在浏览器总输入:http://localhost:端口/ismpbJOA_me/services/BnetForJOA?wsdl 便可以看到wsdl文件,希望对大家有用
cxf与spring整合webservice所需jar
WebService集成Spring的jar最简洁的版本,网上一直不好找,这就自己总结了一份分享出来
spring+axis集成webservice
XFire与Spring集成WebService客户端的两种开发方式.pdfXFire与Spring集成WebService客户端的两种开发方式.pdfXFire与Spring集成WebService客户端的两种开发方式.pdfXFire与Spring集成WebService客户端的两种开发方式...
xfire webservice 集成spring客户端封装成到一个类打包到客户端就像调静态方法一样
在网上找了很久的资料,接口已经跟客户对接,特编写了代码文档和附带jar包,并含其他网站的参考地址,注意jdk环境要1.6或以上版本
Struts+Spring+Hibernate+WebService集成架构
spring.net整合webservice
Cxf集成Spring的WebService接口的配置文档
spring集成axis发布webservice源码 spring集成axis发布webservice源码 spring集成axis发布webservice源码 spring集成axis发布webservice源码
WebService集成Spring的开发,有源码、配置文件、jar包,项目解压后可在tomcat下运行。 eg:http://localhost:8080/webserviceSpring/services
基于spring和CXF发布webservice,包含java本地发布和调用及web发布和调用。
使用spring集成cxf,在两个web project里发布及调用webservice server端使用spring+springmvc+mybatis+cxf,client端使用struts2+spring+hibernate+cxf 两个工程均为myeclipse project,包含所有除myeclipse自带以外...
spring+xfire( 编写webservice完整配置+案例)
想了解webservice,与spring集成步骤,这个很值得才考,大家可以试试看。