Hi all. I've been messing with Google Maps API ( who hasn't? ). I've got my own local Tiger/Line address data. I can feed it addresses via Geo::Coder::US and get useful lat/long coordinates for mapping. My dumb perl script that does this is called in a PHP page ( I know, I should learn mod_perl ), using the PHP exec function. This is suckingly slow because it calls my little Perl script in series to get the lat/long. So, I decided to try to setup a Perl SOAP server. I've followed the "instructions" in this article: http://www.developer.com/tech/article.php/3566631. However, it isn't working for me. Some component is breaking down, and I'm not sure how to trace it. Here's the code peices. At the bottom, I'll post the error I get.
[root@mycomputer html]# ls -lah /data/geocode/ca/geocode_ca.db -rw-r--r-- 1 root root 60M May 23 18:04 /data/geocode/ca/geocode_ca.db [root@mycomputer html]# cat /usr/lib/perl5/site_perl/5.8.8/geocode.pm package geocode; sub geocode { # Designate the location of the geocoding database $geocodes = "/data/geocode/ca/geocode_ca.db"; # Retrieve the address value passed into the function my ($class,$address) = @_; # Point to the geocoding database Geo::Coder::US->set_db($geocodes); # Retrieve coordinates from geocoding database my ($coords) = Geo::Coder::US->geocode($address); # Return the latitudinal and longitudinal coordinates return $coords->{lat},$coords->{long}; } return 1; [root@mycomputer html]# cat geocodews.pl #!/usr/bin/perl -w use Geo::Coder::US; use SOAP::Transport::HTTP; require("geocode.pm"); SOAP::Transport::HTTP::CGI->dispatch_to('geocode')->handle; [root@mycomputer html]# cat geocodeclient.pl #!/usr/bin/perl -w use SOAP::Lite; $soap = SOAP::Lite -> uri('http://localhost/geocode') -> proxy('http://localhost/geocodews.pl'); $address = "900 Cherry Ave., San Bruno, CA"; my $result = $soap->call('geocode', $address); my $latitude = $result->result; my $longitude = $result->paramsout; print "Latitude: ".$latitude."\n"; print "Longitude: ".$longitude."\n";
So, when I run geocodeclient.pl, I get this error:
[root@mycomputer html]# ./geocodeclient.pl not well-formed (invalid token) at line 1, column 1, byte 1 at /usr/li +b/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/XML/Parser.pm line +187 #!/usr/bin/perl -w use Geo::Coder::US; use SOAP::Transport::HTTP; require("geocode.pm"); SOAP::Transport::HTTP::CGI->dispatch_to('geocode')->handle; at ./geocodeclient.pl line 11
I'm totally hacking things together here, but a little tip on how to troubleshoot this would be much appreciated. Thank you!

In reply to SOAP::Lite geocode server by rockneybot

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.