我不知道如何找出如何使用EodData.com启动WSDL连接
wsdl地址是
http://ws.eoddata.com/data.asmx?wsdl
我正在使用CXF创建客户端连接:
QName qname = new QName("http://ws.eoddata.com/Data", "Data");
Data data = new Data(new URL("http://ws.eoddata.com/data.asmx?wsdl"), qname);
DataHttpGet dataGet = data.getDataHttpGet();
dataGet.login("xxx", "ppp");
我得到了
Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Header"). Expected elements are <{http://ws.eoddata.com/Data}LoginResult>
不确定我应该如何启动连接?
解决方法:
使用以下代码进行快速测试对我有用.
使用WSDL2Java:
wsdl2java -autoNameResolution http://ws.eoddata.com/data.asmx?wsdl
然后使用您提供的代码进行一些更改:
QName qname = new QName("http://ws.eoddata.com/Data", "Data");
Data data = new Data(new URL("http://ws.eoddata.com/data.asmx?wsdl"), qname);
DataSoap dataSoap = data.getDataSoap();
LOGINRESPONSE response = dataSoap.login("xxx", "ppp");
System.out.println(response.getMessage());
答复是:
Invalid Username or Password