1.先导spring包
2.首先配置spring.xml的监听web.xml配置。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:Spring-Context.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
3.配置spring.xml文件
//扫描的包(就是类的包名)
<context:component-scan base-package="infis"/>
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
//要暴露的接口
<property name="baseAddress" value="http://192.168.10.183:8800/services/"/>
</bean>
4.就是实体类了
@Component
@WebService(serviceName="lmtService",targetNamespace="lmtCore")
public class LmtList {
@WebMethod
public String getLmtList(@WebParam(name="lmt",targetNamespace="lmtList")String lmtXml) {
System.out.println(lmtXml);
return "YES";
}
}
5.访问接口时要加上实体类的serviceName 例如以上访问地址:http://192.168.10.183:8800/services/lmtService (把上面代码复制就可以运行)