soaperlangyaws

Exception when trying to run example of SOAP with Yaws


I'm trying to run this example of SOAP with Yaws.

I believe that I installed erlsom correctly.

This is what I get:

    1> inets:start().
    ok
    2> yaws_soap_lib:call(
    2>       "http://www.webservicex.net/WeatherForecast.asmx?WSDL",
    2>       "GetWeatherByPlaceName",
    2>       ["Boston"]).
    {ok,undefined,
        [{'soap:Fault',[],
                       {qname,"http://schemas.xmlsoap.org/soap/envelope/","Server",
                              "soap","soap"},
                       "System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> 
    System.Net.WebException: The request failed with the error message:
    \r\n--\r\n<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>301 Moved Permanently</title>\n</head><body>\n<h1>Moved Permanently</h1>\n<p>The document has moved 
<a href=\"http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php\">here</a>.</p>\n<hr>\n<address>Apache/2.2.15 (Red Hat) Server at www.weather.gov Port 80</address>\n</body></html>\n\r\n--.\r\n   
    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)\r\n   
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)\r\n   
    at WeatherService.www.nws.noaa.gov.ndfdXML.NDFDgen(Decimal latitude, Decimal longitude, productType product, DateTime startTime, DateTime endTime, weatherParametersType weatherParameters)\r\n   
    at WeatherService.WeatherForecast.getData(Double latitude, Double longtitude)\r\n   at WeatherService.WeatherForecast.GetWeatherByPlaceName(String PlaceName)\r\n   --- End of inner exception stack trace ---",
                       undefined,
                       {'soap:detail',[],undefined}}]}

Solution

  • I tried this service in SoapUI and got the same result. If you look at the response, it says:

    301 Moved Permanently

    Which means the service endpoint is not at the location specified in the WSDL at the URL you've used. It indicates the web service is now here:

    http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php

    But it is not the same web service. I tried one method and it appears whoever made it didn't quite understand SOAP. The method returned an escaped XML document as a payload.

    So, bottom line, it looks like your attempt is correct (or at least partially correct), they just moved the service somewhere else.