首先对服务端web.xml文件进行配置
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<!-- 实例化容器 -->
<listener>
<listenerclass>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- cxf -->
<servlet>
<description>Apache CXF Endpoint</description>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
然后创建接口和实现接口的实现类
接着对beans.xml文件进行配置
<jaxws:endpoint id="这个地方随意输入" implementor="实现类"
address="/实现类对应的接口" />
这个时候就启动tomcat
[img]http://dl2.iteye.com/upload/attachment/0103/4797/a4f7d186-3c5b-3c2b-8d82-4029478d3fb1.png[/img]
到这个地方获取客户端的web内容
[img]http://dl2.iteye.com/upload/attachment/0103/4823/c16fa999-1c3f-321c-8e86-228014c42db9.png[/img]
先点ADD进行一个方法再点下面框框的sorce获取到我们所需要的内容.
然后创建一个客户端,这是我是用的ajxa来调用的如图
[img]http://dl2.iteye.com/upload/attachment/0103/4837/960af5fe-e8c3-37b6-97d1-6513ed98f7a2.png[/img]
这样就完成了 一个简单的webService
[img]http://dl2.iteye.com/upload/attachment/0103/4841/de18e41b-c872-360b-9a6c-bd13ef9f5bf2.png[/img]
由于这里我是使用了固定的值 你也 可以获取动态的值 放入其中。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<!-- 实例化容器 -->
<listener>
<listenerclass>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- cxf -->
<servlet>
<description>Apache CXF Endpoint</description>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
然后创建接口和实现接口的实现类
接着对beans.xml文件进行配置
<jaxws:endpoint id="这个地方随意输入" implementor="实现类"
address="/实现类对应的接口" />
这个时候就启动tomcat
[img]http://dl2.iteye.com/upload/attachment/0103/4797/a4f7d186-3c5b-3c2b-8d82-4029478d3fb1.png[/img]
到这个地方获取客户端的web内容
[img]http://dl2.iteye.com/upload/attachment/0103/4823/c16fa999-1c3f-321c-8e86-228014c42db9.png[/img]
先点ADD进行一个方法再点下面框框的sorce获取到我们所需要的内容.
然后创建一个客户端,这是我是用的ajxa来调用的如图
[img]http://dl2.iteye.com/upload/attachment/0103/4837/960af5fe-e8c3-37b6-97d1-6513ed98f7a2.png[/img]
这样就完成了 一个简单的webService
[img]http://dl2.iteye.com/upload/attachment/0103/4841/de18e41b-c872-360b-9a6c-bd13ef9f5bf2.png[/img]
由于这里我是使用了固定的值 你也 可以获取动态的值 放入其中。