I was wondering if anyone had any experience parsing out this service? I've been trying for some time now and I keep getting a Bad Gateway message. Below is a sample of the code, I've tried multiple soapclient's, but they all return the same. Any help would be very greatly appreciated.

/* Include NuSoap - see http://sourceforge.net/projects/nusoap for additional info */
	include('soap/nusoap.php');

/* Create Client from WSDL */
//$soapclient = new soapclient('http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl','wsdl');
//$soapclient = new soapclient('http://www.noveltycalls.com/beta/test/ndfdXMLserver.wsdl','wsdl');
$soapclient = new soapclient('http://www.nws.noaa.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php');

$err = $soapclient->getError();
if ($err)
{
	echo('<strong>Unable to make SOAP call</strong>');
}

/* Create Proxy - to Access Services */
//$proxy = $soapclient->getProxy();

/* Switch encoding to UTF-8, since NuSoap default is ISO-8859-1 */
//$proxy->soap_defencoding = "UTF-8";

/* Construct Request */
/*$request = array ("latitude"	=> "Books",
			   "longitude"		=> $page,
			   "startDate"		=> $keywords,
			   "numDays"		=> $keywords,
			   "format"	=> "ItemAttributes,ItemIds,Images,Request");*/

/* Construct All Parameters */
$params = array ("latitude"		=> "27.7115",
				 "longitude"	=> "82.4202",
				 "startDate"	=> "03/19/2007",
				 "numDays"		=> "10",
				 "format"		=> "12 hourly");

/* Submit the Request */
//$result = $proxy->NDFDgenByDay("27.7115","82.4202","03/19/2007","10","12 hourly"
//$result = $soapclient->call('NDFDgenByDay',$params);
$result = $soapclient->call('NDFDgenByDay',$params,'uri:DWMLgenByDay','uri:DWMLgenByDay/NDFDgenByDay');

/* Print Request and Response (Debugging) */
//print $proxy->request;
//print $proxy->response;

//  Processes any SOAP fault information we get back from the server
if ($soapclient->fault)
{
   echo '<h2>Fault</h2><pre>';
   print_r($result);
   print $soapclient->response;
   echo '</pre>';
}
else
{
   //  Capture any client errors
   $err = $soapclient->getError();
   if ($err)
   {
     // Display the error
     echo '<p><b>Error: ' . $err . '</b></p>';
     echo '<h2>Debug</h2>';
     echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
     print $soapclient->response;
   }
   else  // we successfully created the DWML document
   {
      echo $result;
   }
}
    8 days later

    I'd start by searching the nusoap.php source code for some of the error message text to see if you can locate what is outputting that error (assuming it's coming from there).

      11 days later

      Hi Nogdog,

      I took a look and can't find any piece of the nusoap library that displays a '502 Bad Gateway' message. I've been playing with this for days and can't figure this one out, any help would be appreciated.

        A 502 Bad Gateway http response means that some proxy or gateway server that stands between you and the server you're trying to reach wasn't able to deal with the response it got back from that server.

          Write a Reply...