动态webservice转发

来自ling
跳转至: 导航搜索

https://examples.javacodegeeks.com/enterprise-java/jws/jax-ws-dynamic-proxy-client-example/

https://www.javaxt.com/javaxt-core/webservices/

https://blog.csdn.net/ichigorukia123/article/details/104612521

//Parse WSDL
  String url = "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL";
  javaxt.webservices.WSDL wsdl = new javaxt.webservices.WSDL(url);
 
//Set Parameters
  javaxt.webservices.Service service = wsdl.getServices()[0];
  javaxt.webservices.Method method = service.getMethod("CountryName");
  javaxt.webservices.Parameters parameters = method.getParameters();
  parameters.setValue("sCountryISOCode", "US");
 
//Execute Web Method and Print Response
  javaxt.webservices.SoapRequest soap = new javaxt.webservices.SoapRequest(service, method, parameters);
  try{
      String countryName = soap.getResponse().toString();
      System.out.println(countryName);
  }
  catch(Exception e){
      e.printStackTrace();
  }