in reply to SOAP::Lite geocode server

in geocodeclient.pl, change use SOAP::Lite; to
use SOAP::Lite ( +trace => 'all', readable => 1, outputxml => 1, ); # +for debugging
It'll show you all the data exchange, and might help you to track down the issue.

I assume you're running the soap server under Apache, right? Check the error log, there's probably something there that'll be closer to the problem. Show us what it says if you can't figure it out.

Some additional suggestions:

  1. use strict and warnings
  2. move the use Geo::Coder::US; from gecodews.pl to geocode.pm where it belongs
  3. I'd recommend returning your values as a hash reference, instead of pulling one value out of result and the other from paramsout:
    1. in geocode.pm, simply return $coords
    2. in geocodeclient.pl, change it to
      my $result = $soap->call('geocode', $address); my $coords = $result->result; print "Latitude: ".$coords->{lat}."\n"; print "Longitude: ".$coords->{lon}."\n";

Replies are listed 'Best First'.
Re^2: SOAP::Lite geocode server
by rockneybot (Novice) on May 25, 2006 at 01:20 UTC
    I followed your recommendations. Here are the results of the trace (truncated):
    SOAPAction: "http://localhost/geocode#geocode" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <geocode xmlns="http://localhost/geocode"> <c-gensym3 xsi:type="xsd:string">900 Cherry Ave., San Bruno, CA< +/c-gensym3> </geocode> </soap:Body> </soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x859 +a190) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Thu, 25 May 2006 01:11:56 GMT Accept-Ranges: bytes ETag: "16d01ff-94-89b58cc0" Server: Apache/2.2.0 (Fedora) Content-Length: 148 Content-Type: text/plain; charset=UTF-8 Last-Modified: Thu, 25 May 2006 01:11:55 GMT Client-Date: Thu, 25 May 2006 01:11:56 GMT Client-Peer: 127.0.0.1:80 Client-Response-Num: 1 #!/usr/bin/perl -w use strict; use SOAP::Transport::HTTP; require("geocode.pm"); SOAP::Transport::HTTP::CGI->dispatch_to('geocode')->handle; Can't call method "result" without a package or object reference at ./ +geocodeclient.pl line 13. SOAP::Transport::HTTP::Client::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Lite::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Lite::DESTROY: ()
      Aha! Your soap server isn't executed, it's returned by the web server as a plaintext document!

      You need to make sure that your geocodews.pl is executed as a perl script by the web server. The simplest way to do that, I guess, is by putting it in your cgi-bin directory. Change the proxy() call to reflect the new url of the soap server.

        Oh! Thank you so much! I didn't think of that. Works like a charm now. I hope this SOAP server will respond faster than my old method.