Spring3jdbc架构整合webservice框架cxf
1.下载cxf全部jar包引入项目
2.src下新建spring-cxf.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean id="dsst" class="com.dh.dsstinterface.DtInterfaceImpl" />
<jaxws:endpoint id="dtInterface" implementor="#dsst" address="/DtInterface" />
</beans>
3.修改web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<!--spring配置文件放在WEB-INF目录下-->
<param-value>classpath*:/spring-cxf.xml,classpath*:/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
4.新建接口和接口实现
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public interface DtInterface {
/**
* 彩信发送接口
*
* @param emsxml
* 客户端传入XMl
* @return
* code(标记,0、失败;1成功);message1(出错字段名,成功时为返回短信字段信息);message(描述信息
* )
*/
public String sendEms(String emsxml);
}
import javax.jws.WebService;
import org.apache.commons.io.FileUtils;
import org.dom4j.DocumentHelper;
import org.dom4j.Document;
import org.dom4j.Element;
import java.util.Iterator;
import java.io.File;
import com.dh.dsstinterface.DsstInterface;
import com.dh.util.DateUtil;
import com.dh.util.FileUtil;
import com.dh.util.SendMessageUtil;
import com.dh.util.Util;
import java.io.File;
import java.net.URL;
/**
* Created by MyEclipse. User: szj Date: 2011-10-12 Time: 09:52 To change this
* template use File | Settings | File Templates.
*/
@WebService
public class DtInterfaceImpl implements DtInterface {
/**
* 彩信发送接口
*
* @param emsxml
* 客户端传入XMl
* @return code(标记,0、失败;1成功);message1(出错字段名,成功时为返回短信字段信息);mess