调用webservice接口报错
try{Stringendpoint="http://202.127.166.175:8082/services/FgwWebService?wsdl";//直接引用远程...
try {
String endpoint = "http://202.127.166.175:8082/services/FgwWebService?wsdl";
//直接引用远程的wsdl文件
//以下都是套路
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName("http://webservice.lxzy.dhcc.com");//WSDL里面描述的接口名称
call.addParameter("userName", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);//接口的参数
call.addParameter("certificate", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
// String[] temp={"1","2"};
String result = (String)call.invoke(new Object[]{"张三","11"});
//给方法传递参数,并且调用方法
System.out.println("result is "+result);
}
catch (Exception e) {
System.err.println(e.toString());
}
错误信息
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,10]
Message: Element type "http:" must be followed by either attribute specifications, ">" or "/>". 展开
String endpoint = "http://202.127.166.175:8082/services/FgwWebService?wsdl";
//直接引用远程的wsdl文件
//以下都是套路
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName("http://webservice.lxzy.dhcc.com");//WSDL里面描述的接口名称
call.addParameter("userName", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);//接口的参数
call.addParameter("certificate", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
// String[] temp={"1","2"};
String result = (String)call.invoke(new Object[]{"张三","11"});
//给方法传递参数,并且调用方法
System.out.println("result is "+result);
}
catch (Exception e) {
System.err.println(e.toString());
}
错误信息
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,10]
Message: Element type "http:" must be followed by either attribute specifications, ">" or "/>". 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询