EodData wsdl java connection

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

wsdl address

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

I use 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 a connection?

+4
source share
1 answer

A quick test worked for me using the following code.

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

Answer:

 Invalid Username or Password 
+1
source

Source: https://habr.com/ru/post/1316191/


All Articles