一。创建服务器
(1)建立接口与实现类
(2)引入XFire的jar包. Core.jar, common-loggin, jdom, spring-1.2.6, wsdl4j, xbean-2.2.0, xbean-spring-2.8, xfire-all, xfire-spring-1.2.6
(3)在/META-INF/xfire/services.xml中配置服务.
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<name>服务名</name>
<namespace>命名空间</namespace>
<serviceClass>
接口全路径
</serviceClass>
<implementationClass>
实现类全路径
</implementationClass>
</service>
</beans>
(4)访问测试这个服务发布是否成功: http://localhost:8080/项目名/services/服务名?wsdl
注意wsdl最后的地址: <wsdlsoap:address location="http://localhost:8080/WebServiceTest1/services/helloworld"/>
二。创建客户端
(1)导出服务器端的接口jar文件.
(2)引入XFire的jar包. commons-codec, commons-httpclient, commons-loggin, jdom-1.0, wsdl4j, xfire-all, xfire-core
(3) 将集合中存的对象类创建起来.
(3)创建servlet调用服务.
Service servicemodel=new ObjectServiceFactory().create(接口名.class);
XFire xfire=XFireFactory.newInstance().getXFire();
XFireProxyFactory factory=new XFireProxyFactory(xfire);
String url="服务地址";
接口名 i=null;
i=(接口名)factory.create(servicemodel, url);
//调用方法
(1)建立接口与实现类
(2)引入XFire的jar包. Core.jar, common-loggin, jdom, spring-1.2.6, wsdl4j, xbean-2.2.0, xbean-spring-2.8, xfire-all, xfire-spring-1.2.6
(3)在/META-INF/xfire/services.xml中配置服务.
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<name>服务名</name>
<namespace>命名空间</namespace>
<serviceClass>
接口全路径
</serviceClass>
<implementationClass>
实现类全路径
</implementationClass>
</service>
</beans>
(4)访问测试这个服务发布是否成功: http://localhost:8080/项目名/services/服务名?wsdl
注意wsdl最后的地址: <wsdlsoap:address location="http://localhost:8080/WebServiceTest1/services/helloworld"/>
二。创建客户端
(1)导出服务器端的接口jar文件.
(2)引入XFire的jar包. commons-codec, commons-httpclient, commons-loggin, jdom-1.0, wsdl4j, xfire-all, xfire-core
(3) 将集合中存的对象类创建起来.
(3)创建servlet调用服务.
Service servicemodel=new ObjectServiceFactory().create(接口名.class);
XFire xfire=XFireFactory.newInstance().getXFire();
XFireProxyFactory factory=new XFireProxyFactory(xfire);
String url="服务地址";
接口名 i=null;
i=(接口名)factory.create(servicemodel, url);
//调用方法