问题描述
xfire客户端怎么调用啊比如我的WSDL发布成功了<service><name>Banking</name><namespace>service</namespace><serviceClass>org.bank.xfire.example.IBankingService</serviceClass><implementationClass>org.bank.xfire.example.BankingService</implementationClass></service>http://localhost:8080/service/services/Banking能显示发布成功的!客户端我也写了个类callWebServicepublicStringtransferFunds(StringfromAccount,StringtoAccount,doubleamount,Stringucurrencyrrency){////CreateametadataoftheserviceServiceserviceModel=newObjectServiceFactory().create(IBankingService.class);//CreateaproxyforthedeployedserviceXFirexfire=XFireFactory.newInstance().getXFire();XFireProxyFactoryfactory=newXFireProxyFactory(xfire);StringserviceURL="http://localhost:8080/service/services/Banking";IBankingServicebankService=null;try{bankService=(IBankingService)factory.create(serviceModel,serviceURL);}catch(MalformedURLExceptione){e.printStackTrace();}StringserviceResponse="";try{serviceResponse=bankService.transferFunds(fromAccount,toAccount,amount,ucurrencyrrency);}catch(Exceptione){e.printStackTrace();serviceResponse=e.toString();}System.out.println(serviceResponse);returnserviceResponse;}去调用那个方法,我想知道我在浏览器怎么调用这个客户端的方法啊!谢谢赐教![b]说的对我立刻给分!!!!!!!!!!!![/b]
解决方案
本帖最后由 sealave 于 2010-11-12 15:14:39 编辑
解决方案二:
有多种调用方式,其中一种是动态调用:importjava.net.URL;importorg.codehaus.xfire.client.Client;publicclasstest{publicvoiduseWebService{Clientclient=newClient(newURL("URL路径"));Object[]results=client.invoke("方法名",newObject[]{"","",可以输入参数});//进一步地,可以人results中取出返回结果}}
解决方案三:
我第一次接触这个,所以问个愚蠢的问题,客户端调用智能通过你说的这种方法调用,不能通过地址栏输入,比如http://localhost:8080/service/services/Banking?方法名=参数&参数!