尝试 运行 带有 Yaws 的 SOAP 示例时出现异常

Exception when trying to run example of SOAP with Yaws

我正在尝试 运行 this Yaws SOAP 示例。

我相信我正确安装了 erlsom。

这是我得到的:

    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}}]}

我在 SoapUI 中尝试了此服务并得到了相同的结果。如果您查看响应,它会显示:

301 Moved Permanently

这意味着服务端点不在您使用的 URL 的 WSDL 中指定的位置。它表示网络服务现在在这里:

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

但它不是同一个网络服务。我尝试了一种方法,看来制作它的人不太了解 SOAP。该方法返回一个转义的 XML 文档作为有效负载。

所以,最重要的是,看起来您的尝试是正确的(或至少部分正确),他们只是将服务转移到了其他地方。