/×客户端测试方法×/ public String callWebService( ? ? ? ? ? throws MalformedURLException,Exception { ? ? ? ? ? ? ? ? Service serviceModel = new ObjectServiceFactory().create(IBankingService.class); ? ? ? ? ? ? ? ? ? System.out.println("callSoapServiceLocal(): got service model." ); ? ? ? ? ? XFire xfire = XFireFactory.newInstance().getXFire(); ? ? ? ? ? XFireProxyFactory factory = new XFireProxyFactory(xfire); ? ? ? ? ? ? ? ? String serviceUrl = "http://localhost:8080/websvc/services/Banking"; ? ? ? ? ? IBankingService client = null; ? ? ? ? ? ? ? client = (IBankingService) factory.create(serviceModel,serviceUrl); ? ? ? ? ? } catch (MalformedURLException e) { ? ? ? ? ? ? ? System.out.println("WsClient.callWebService(): EXCEPTION: " + e.toString()); ? ? ? ? ? } ? ? ? ? ? ? ? String serviceResponse = ""; ? ? ? ? ? ? ? serviceResponse = client.transferFunds(fromAccount,toAccount,amount,currency); ? ? ? ? ?} catch (Exception e){ ? ? ? ? ? ? ? System.out.println("WsClient.callWebService(): EXCEPTION: " + e.toString()); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? serviceResponse = e.toString(); ? ? ? ? ? } ? ? ? ? ? ? ? ? ? System.out.println("WsClient.callWebService(): status=" + serviceResponse); ? ? ? ? ? ? ? ? ? ? return serviceResponse; ? ? ? }? |