Error running sample web service code from weather.gov
I'm trying to integrate weather data from the NOAA in my web site, and as a starting point I was trying to run their sample code (available here. The specific sample I'm trying to work with is开发者_运维百科 the Basic Client sample (starting point is ndfdXML.htm).
I've followed the readme instructions for downloading nuSOAP and changing location to local paths, and changing the location of soapclient to www.weather.gov instead of localhost, but I'm still getting an error when I actually submit the page.
The error only shows up when I do a view-source, and this is what it says:
Fatal error: Uncaught SoapFault exception:
[WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php':
Extra content at the end of the document in /opt/lampp/htdocs/weather/ndfdXMLclient.php:179
Stack trace:
#0 /opt/lampp/htdocs/weather/ndfdXMLclient.php(179): SoapClient->SoapClient('http://www.weat...')
#1 {main} thrown in /opt/lampp/htdocs/weather/ndfdXMLclient.php on line 179
Any idea what this means? I've been unable to find any kind of help offered by the actual weather service.
I bet you need to put the actual path to the wsdl in your SoapClient code.
http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl
(note the "?wsdl" at the end)
It looks like your code is trying to create the SoapClient using http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php as the path for the wsdl. If you actually go there, you can see that this isn't the wsdl. It is actually located at the first url in this post.
精彩评论