Loading ...
Sorry, an error occurred while loading the content.

gSOAP client, SOAP::Lite server, access denied?

Expand Messages
  • Jeff Schmidt
    I m having a devil of a time trying to get a very simple gSOAP client to talk to a very simple SOAP::Lite server. The server works fine when I use a SOAP::Lite
    Message 1 of 3 , Jul 30, 2003
    • 0 Attachment
      I'm having a devil of a time trying to get a very simple gSOAP client
      to talk to a very simple SOAP::Lite server. The server works fine when
      I use a SOAP::Lite client, but I get the following access denied error
      from the gSOAP client (Mac OS X):

      SOAP FAULT: SOAP-ENV:Client
      "Denied access to method (getStateName) in class (main) at
      /Library/Perl/SOAP/Lite.pm line 2128."

      Relevant logs and code snippets below. Can anyone help me out here?


      *** SENT.log:

      POST /cgi-bin/soap.cgi HTTP/1.1
      Host: localhost
      User-Agent: gSOAP/2.3
      Content-Type: text/xml; charset=utf-8
      Content-Length: 491
      Connection: close
      SOAPAction: "#getStateName"

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmln
      s:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
      http://www.w3.org/2001/XMLSchema"
      xmlns:ns="http://localhost/Statename/"><SOAP-ENV:Body
      SOAP-ENV:encodingStyle="http://s
      chemas.xmlsoap.org/soap/encoding/"
      id="_0"><getStateName><stateNum>23</stateNum></getStateName></SOAP-
      ENV:Body></SOAP-EN
      V:Envelope>



      *** RECV.log:

      HTTP/1.1 500 Internal Server Error
      Date: Wed, 30 Jul 2003 14:32:48 GMT
      Server: Apache/1.3.27 (Darwin) PHP/4.3.0
      SOAPServer: SOAP::Lite/Perl/0.55
      Content-Length: 630
      Connection: close
      Content-Type: text/xml; charset=utf-8

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP
      -ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
      " xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body><SOA
      P-ENV:Fault><faultcode
      xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultstring
      xsi:type="xsd:string">Denied access
      to method (getStateName) in class (main) at /Library/Perl/SOAP/Lite.pm
      line 2128.
      </faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>



      *** Client (gSOAP) code:

      SOAP_NMAC struct Namespace namespaces[] =
      {
      {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/",
      "http://www.w3.org/*/soap-envelope"},
      {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/",
      "http://www.w3.org/*/soap-encoding"},
      {"xsi", "http://www.w3.org/2001/XMLSchema-instance",
      "http://www.w3.org/*/XMLSchema-instance"},
      {"xsd", "http://www.w3.org/2001/XMLSchema",
      "http://www.w3.org/*/XMLSchema"},
      {"ns", "http://localhost/Statename/"},
      {NULL, NULL}
      };


      int call_getStateName(char* url, char* urn, int stateNum, char**
      stateName)
      {
      int retval = 0;
      struct soap soap;
      soap_init(&soap);
      if (retval = soap_call_getStateName(&soap, url, urn, stateNum,
      stateName))
      soap_print_fault(&soap, stderr);

      return retval;
      }


      *** Server (SOAP::Lite) code:

      #!/usr/bin/perl -w

      # -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul Kulchenko --

      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Statename')
      -> handle
      ;


      package Statename;

      sub new {
      bless {}, shift;
      }

      sub test {
      my $self = shift;
      return "Hiya";
      }

      sub getStateName {
      my @states = (undef,
      qw/Alabama Alaska Arizona Arkansas California
      Colorado Connecticut
      Delaware Florida Georgia Hawaii Idaho Illinois
      Indiana Iowa Kansas
      Kentucky Louisiana Maine Maryland Massachusetts
      Michigan Minnesota
      Mississippi Missouri Montana Nebraska Nevada/, 'New
      Hampshire',
      'New Jersey', 'New Mexico', 'New York', 'North
      Carolina',
      'North Dakota', qw/Ohio Oklahoma Oregon
      Pennsylvania/, 'Rhode Island',
      'South Carolina', 'South Dakota', qw/Tennessee Texas
      Utah Vermont
      Virginia Washington/, 'West Virginia', 'Wisconsin',
      'Wyoming'
      );
      my ($self, $idx) = @_;
      return $states[$idx];
      }

      1;


      Jeffrey Schmidt, senior software architect, MultiAd
      jschmidt@..., AIM:jfsaim
    Your message has been successfully submitted and would be delivered to recipients shortly.