时间:2011-04-16 海边沫沫
现在,重新构建项目,部署,启动Tomcat,就可以通过访问 http://www.yumdays.com/service/IndexService?wsdl来测试该WebService是否成功被部署 了。如下图:
第六步,创建客户端,这一步非常的容易,只需要下面这样的配置:
<?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-2.0.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="client" class="com.yumdays.service.IndexService" factory- bean="clientFactory" factory-method="create"/>
<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="com.yumdays.service.IndexService"/>
<property name="address" value="http://www.yumdays.com/service/IndexService"/>
</bean>
</beans>
就可以获得一个名称为client的bean,通过该bean,就可以非常方便的访问索引服务器提 供的功能。 |