你的位置:首页 > Java教程

[Java教程]java调用netwebservice


java调用netwebservice--soap:

  try {

String url = "http://192.168.12.106/yhcapp/MesServerMng.asmx?wsdl";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(url));

//WSDL里面描述的接口名称,参数说明为:QName(" call.setOperationName(new QName("http://www.hustcad.com/InteCAPP/

//ProjectNo 为Mes_ProjectInfo 方法里的参数,有多个的话复制一行即可,注意后面的类型--XSD_STRING
call.addParameter(newQName("http://www.hustcad.com/InteCAPP/ call.setReturnType(org.apache.axis.encoding. call.setSOAPActionURI("http://www.hustcad.com/InteCAPP/ String ProjectNo = "要传入的数据"
String result = (String)call.invoke(new Object[]{ProjectNo}); //多个变量逗号隔开即可
System.out.println("返回结果为:"+result);

} catch (Exception e) {
System.out.println(e.getMessage());
}