EodData wsdl java connection

落花浮王杯 提交于 2019-12-23 15:50:37

问题


I am stuck trying to figure out how to initiate a WSDL connection with EodData.com

the wsdl address is

http://ws.eoddata.com/data.asmx?wsdl

I am using CXF to create a client connection:

 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");

and I got

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> 

Not sure how I should initiate the connection?


回答1:


A quick test using the following code worked for me.

Using WSDL2Java:

wsdl2java -autoNameResolution http://ws.eoddata.com/data.asmx?wsdl

Then using the code you provided with a few changes:

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());

The response was:

Invalid Username or Password


来源:https://stackoverflow.com/questions/3283211/eoddata-wsdl-java-connection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!