java ssh cxf_在S2SH中添加Web Service(CXF),怎么CXF集成SSH

下面是:beanContext-spring-cxf.xml 中的配置;(一定要注意顶部引入的beans里面的spring 配置一定要和你spring的版本一样不然不行哦)

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:aop="http://www.springframework.org/schema/aop"

xmlns:tx="http://www.springframework.org/schema/tx"

xmlns:jaxws="http://cxf.apache.org/jaxws"

xsi:schemaLocation="

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd

http://cxf.apache.org/jaxws

http://cxf.apache.org/schemas/jaxws.xsd">

Web.xml 中的配置(一定记得在里面添加这么一段,不然启动报错哟。);

CXFService

org.apache.cxf.transport.servlet.CXFServlet

30

CXFService

/ws/*

cxf-2.3.3.jar

geronimo-annotation_1.0_spec-1.1.1.jar

geronimo-jaxws_2.2_spec-1.0.jar

geronimo-stax-api_1.0_spec-1.0.1.jar

geronimo-ws-metadata_2.0_spec-1.1.3.jar

jaxb-api-2.2.1.jar

jaxb-impl-2.2.1.1.jar

neethi-2.0.4.jar

wsdl4j-1.6.2.jar

XmlSchema-1.4.7.jar

wstx-asl-3.2.9.jar

以上包是基本最少而且缺一不可的。其它包仅需求再加。

下面是接口的具体写法:

package com.flmk.urms.cxf;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.WebService;

import com.flmk.urms.entity.TUser;

@WebService

public interface UserLoginServiceI {

@WebMethod

public TUser userLogin(@WebParam(name="userName") String userName,@WebParam(name="passWord") String passWord);

}

接口实现类的写法:

package com.flmk.urms.cxf.impl;

import javax.annotation.Resource;

import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;

import com.flmk.urms.core.user.service.UserService;

import com.flmk.urms.cxf.UserLoginServiceI;

import com.flmk.urms.entity.TUser;

@WebService

public class UserLoginServiveImpl implements UserLoginServiceI{

@Autowired

private UserService userService;

@Resource

public void setUserService(UserService userService) {

this.userService = userService;

}

@Override

public TUser userLogin(String userName, String passWord) {

return userService.userAuthenticate(userName, passWord);

}

}

基本上就是以上这些配置了,再次记录以便以后忘记。。O(∩_∩)O~

原文:http://my.oschina.net/yang5610/blog/501608

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值