Hi All - Im a rank newbie to Java and eclipse.
I am making a first attempt at interacting with a web service and Im failing.
The webservice is wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL
I successfully wsimported it and copied in the classes, then wrote the code while following along with a javabrain tutorial on the subject (for a different web service that apparently no longer exists).
The webserver is supposed to deliver weather elements based on zipcode. I 'runas' 'run configurations' to run the package, and have tried setting the 'program arguments' to various zips - including a new york zip - 10001. But to no avail.
The code doesnt show any errors in eclipse, but when I run it, I get the errors below:
Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultExcep tion: Client received SOAP Fault from server: Server was unable to process request. ---> A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProto colException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.cre ateException(SOAPFaultBuilder.java:116)
at com.sun.xml.internal.ws.client.sei.StubHandler.rea dResponse(StubHandler.java:238)
at com.sun.xml.internal.ws.db.DatabindingImpl.deseria lizeResponse(DatabindingImpl.java:189)
at com.sun.xml.internal.ws.db.DatabindingImpl.deseria lizeResponse(DatabindingImpl.java:276)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandl er.invoke(SyncMethodHandler.java:104)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandl er.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke( SEIStub.java:147)
at com.sun.proxy.$Proxy31.getCityWeatherByZIP(Unknown Source)
at org.kabbott.java.WeatherByZip.main(WeatherByZip.ja va:18)
Im using the following code:
package org.kabbott.java;
import com.cdyne.ws.weatherws.Weather;
import com.cdyne.ws.weatherws.WeatherReturn;
import com.cdyne.ws.weatherws.WeatherSoap;
public class WeatherByZip {
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("you need to give an IP address");
}
else {
String zip = args[0];
Weather weatherService = new Weather(); //creates instance of weatherservice
WeatherSoap WeatherServiceSoap = weatherService.getWeatherSoap(); // creates weatherServiceSoap stub
WeatherReturn weatherReturn = WeatherServiceSoap.getCityWeatherByZIP(zip);
// System.out.println(weatherReturn.getCity());
System.out.println(weatherReturn.getTemperature()) ;
// System.out.println(weatherReturn.getRelativeHumidi ty());
// System.out.println(weatherReturn.getPressure());
// System.out.println(weatherReturn.getWind());
// System.out.println(weatherReturn.getWindChill());
}
}
}
Is there an error in my code somewhere or is this just an issue with the webserver itself
If it is, or probably is, the webservice - does anyone know a simple reliable web service I can practice on?
thanks