Thank you for you reply, but I'm looking for an example or tutorial that shows me step by step how I simply can call an external web service from java (eclipse).
Hi mrcoffee365,
Thank you for the link. I have tried to execute the code, but I'm receiving the following error message:
Exception in thread "main" java.lang.ClassCastException: org.apache.xerces.dom.DeferredDocumentImpl cannot be cast to javax.swing.text.Document
at WebServiceCall.parseXmlFile(WebServiceCall.java:126)
at WebServiceCall.getWeather(WebServiceCall.java:93)
at WebServiceCall.main(WebServiceCall.java:33)
The code is attached.
Your assistance is greatly appreciated. WebServiceCall.java
The exception is pretty clear. This line, 126 in your program:
return (Document) db.parse(is);
is trying to cast the results of DocumentBuilder db.parse method to a Document type. So check the return type of the db.parse method, and cast it to the correct type or convert it to what you need.
http://docs.oracle.com/javaee/6/api/index.html?javax/servlet/http/HttpServletRequest.html
Most people use the Apache commons HttpClient as a wrapping package, since it handles redirects and cookies:
http://hc.apache.org/httpcomponents-client-ga/index.html