日期:2014-05-20  浏览次数:20557 次

求webservice 调用示例
webservice
------解决方案--------------------
用xfire:
在webservice工程里指定好:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">

<service>
<name>servicename</name>
<namespace>http://localhost:8080/projectname/servicename</namespace>
<serviceClass>com.serviceinterface</serviceClass>
<implementationClass>com.serviceinterfaceimpl</implementationClass>
<style>wrapped</style>
<use>literal</use>
<scope>application</scope>
</service></beans>

再把接口打包。添加到web工程里
在你的web工程里调用:

Service myService=new ObjectServiceFactory().create(serviceinterface.class);
XFire xFire=XFireFactory.newInstance().getXFire();
XFireProxyFactory xpFactory=new XFireProxyFactory(xFire);
String serviceUrl="http://localhost:8080/projectname/services/servicename";

Serviceinterface service=(Serviceinterface )xpFactory.create(myService, serviceUrl);
     //     service,这个对象就可以调用方法了。


------解决方案--------------------
http://download.csdn.net/download/TrimRay/858350
自己看看