日期:2014-05-17 浏览次数:20892 次
//OK public static void quickReg(String tel) { final String wsdl = "http://localhost:8000/services/UserInfoWebService"; Service service = new Service(); Call call; try { call = (Call) service.createCall(); try { call.setTargetEndpointAddress(new java.net.URL(wsdl)); } catch (MalformedURLException e) { e.printStackTrace(); } call.setOperationName("quick");//WSDL里面描述的接口名称 call.getMessageContext().setUsername("user"); call.getMessageContext().setPassword("password"); call.addParameter("userphone", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);//接口的参数 call.addParameter("checkcode", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);//接口的参数 call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); Object xml; try { xml = (Object)call.invoke(new Object[]{tel,"code"}); //给方法传递参数,并且调用方法 System.out.println("result is "+xml); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
------解决方案--------------------
估计是.net的配置的问题,好好查一下吧