Ok - actually, I separated things back out, and it seems to be a SOAP problem to begin with.

The forecast.pl script only makes the request, and then saves it to an XML file.

#!/usr/bin/perl use SOAP::Lite; use DateTime; my $lattitude = 28.3887; my $longitude = -81.4773; my $numDays = 6; # up to 7 days my $format = '12 hourly'; # '12 hourly' or '24 hourly' my $xml_file = 'forecast.xml'; my $dt = DateTime->now; $dt->set_time_zone('local'); my $startDate = $dt->strftime('%Y-%m-%d%z'); $startDate =~ s/(\d{2})(\d{2})$/$1:$2/; # final format: "2005-01-24-06 +:00" my $serviceURI = 'http://weather.gov/forecasts/xml'; my $method = 'NDFDgenByDay'; my $endpoint = "$serviceURI/SOAP_server/ndfdXMLserver.php"; my $soapAction = "$serviceURI/DWMLgen/wsdl/ndfdXML.wsdl#$method"; my $weather = SOAP::Lite->new(uri => $soapAction, proxy => $endpoint); my $response = $weather->call( SOAP::Data->name($method) => SOAP::Data->type(decimal => $lattitude)->name('latitude'), => SOAP::Data->type(decimal => $longitude)->name('longitude'), => SOAP::Data->type(date => $startDate)->name('startDate'), => SOAP::Data->type(integer => $numDays )->name('numDays'), => SOAP::Data->type(string => $format )->name('format') ); if ($response->fault) { printf "A fault (%s) occurred: %s\n", $response->faultcode, $response->faultstring; } else { open(OUT, ">$xml_file"); print OUT $response->result; }

It is giving the following error:

not well-formed (invalid token) at line 77, column 13, byte 3304 at /usr/lib/perl5/vendor_perl/5.12.2/i686-linux/XML/Parser.pm line 187

Here is the Trace if it is any help:

https://dl.dropbox.com/u/2859483/putty071742.log

I verified with the original author that the script is currently working on his site right now.

So I am not sure where to go next with getting this to work.

Thanks for any insight!

John


In reply to Re: Parsing NDFD with XML::Simple by johnfl68
in thread Parsing NDFD with XML::Simple by johnfl68

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.