webservice接口调用问题
先上代码:
import java.net.URL;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import com.test.webservice.query.chg.ChgQueryStandInterfaceSoapBindingStub;
public class QuerySdInfo {
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
try {
String sUrl = "http://192.34.18.2/comp/servicedesk/services/ChgQueryStandInterface/wsdl/ChgQueryStandInterface.wsdl";
String xmlstr = "<?xml version='1.0' encoding='UTF-8' ?><SD><IN><CFNUMBER>svds</CFNUMBER><CFNUMBER_PWD>safe1pwd9</CFNUMBER_PWD><SDNO>ABCD111</SDNO></IN></SD>";
String result = "";
URL url = new URL(sUrl);
Service service = new Service();
ChgQueryStandInterfaceSoapBindingStub stub = new ChgQueryStandInterfaceSoapBindingStub(url, service);
if (stub == null)
System.out.println("binding is null");
stub.setTimeout(60000);
result = stub.chgQuery(xmlstr);
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
}
}
这个wsdl连接用浏览器打卡可以正常访问,ChgQueryStandInterfaceSoapBindingStub 这个类是用eclipse的webservice客户端自动生成的。
运行这个程序报如下错误:
javax.xml.rpc.JAXRPCException:WSWS3122E:找不到在URI /comp/servicedesk/services/ChgQueryStandInterface/wsdl/ChgQueryStandInterface.wsdl中引用的服务 services/ChgQueryStandInterface/wsdl/ChgQueryStandInterface.wsdl