使用Eclipse-j2ee中運用wtp外掛實現webservice呼叫
阿新 • • 發佈:2018-12-31
執行之後,結果如下 <?xml version='1.0'?><result><state>1</state><state_desc>查詢成功</state_desc><count>222</cimport java.rmi.RemoteException; import javax.xml.rpc.ServiceException; public class TestCallSoap { public static void main(String[] args){ HISWS.HISWSServiceLocator ws = new HISWS.HISWSServiceLocator(); String str = ""; try { str = ws.getHISWSPort().getHospitals( "test", "test" ); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } System. out.println(str); } }
到此呼叫成功!