package com.test.inf; @WebService(targetNamespace = "http://inf.test.com/") public interface testService{ public abstract String test(@WebParam(name="arg0") String name); }
接口参数也可以是一个java 对象,可以自定义。
@WebService public class testServiceImpl implements testService{ public String test(String name) { //业务处理 } }
配置文件:
<?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:context="http://www.springframework.org/schema/context" 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://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.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" /> <context:component-scan base-package="com.test.inf" /> <jaxws:endpoint id="syncUserService" implementor="com.test.inf.testServiceImpl " address="/testInf"> <jaxws:inInterceptors> <bean name="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/> </jaxws:inInterceptors> <jaxws:outInterceptors> <bean name="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> </jaxws:outInterceptors> </jaxws:endpoint> </beans>
接口地址 以 ?testInf.wsdl 结尾