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

Denied access to method error

Expand Messages
  • aviannachao
    Hi all, I made a simple hello world web service, and a corresponding WSDL page. #HelloWorld.pl use SOAP::Transport::HTTP; use HelloWorld;
    Message 1 of 1 , Sep 3, 2004
      Hi all,

      I made a simple hello world web service, and a corresponding WSDL page.

      use SOAP::Transport::HTTP;
      use HelloWorld;

      -> dispatch_to('HelloWorld')
      -> handle;

      package HelloWorld;

      sub sayHello {
      return "Yo you there! ".$_[1];


      I put this web service on my local machine, and have no problems
      accessing it via direct Perl invocation, with or without autodispatch,

      # with autodispatch, works fine
      use SOAP::Lite +autodispatch =>
      uri => 'HelloWorld',
      proxy => 'http://localhost/soaptest/HelloWorld.pl';

      my $a=HelloWorld->sayHello('Avianna');
      print $a;

      # without autodispatch, also works fine
      use SOAP::Lite +trace;

      print SOAP::Lite
      -> uri('HelloWorld')
      -> proxy('http://localhost/soaptest/HelloWorld.pl')
      -> sayHello('Avianna')
      -> result;

      However, when I try to access the web service via the WSDL page, I get
      an error.

      <?xml version="1.0"?>
      <definitions name="HelloWorld"
      <xsd:schema targetNamespace="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="sayHelloRequest" type="xsd:string" />
      <xsd:element name="sayHelloResponse" type="xsd:string" />
      <message name="sayHelloRequest">
      <part name="sayHelloRequestSoapMsg" element="xsdl:sayHelloRequest"/>
      <message name="sayHelloResponse">
      <part name="sayHelloResponseSoapMsg" element="xsdl:sayHelloResponse"/>
      <portType name="HelloWorldPortType">
      <operation name="sayHello">
      <input message="tns:sayHelloRequest" />
      <output message="tns:sayHelloResponse" />
      <binding name="HelloWorldBinding" type="tns:HelloWorldPortType">
      <soap:binding style="document"
      <operation name="sayHello">
      <soap:operation style="document" soapAction=""/>
      <soap:body use="literal"/>
      <soap:body use="literal"/>
      <service name="HelloWorld">
      Test HelloWorld web service
      <port name="HelloWorldPort" binding="tns:HelloWorldBinding">
      <soap:address location="http://localhost/soaptest/HelloWorld.pl"/>

      use SOAP::Lite +trace;

      my $g = SOAP::Lite

      print $g;

      hello_wsdl.pl output:

      Denied access to method (sayHello) in class (main) at
      C:/Perl/site/lib/SOAP/Lite.pm line 2159

      What is causing this?? Is this a problem with my WSDL page? I did 2
      versions, one was hand coded, pretty much copying the example from the
      Programming Web Services with Perl book, and the one above was
      generated using the WSDL::Generator module. The WSDL pages are very
      similar except the WSDL page from the book uses binding style=rpc and
      the one generated from WSDL::Generator uses style=document.

      Any ideas would be appreciated.

      Thanks in advance.
    Your message has been successfully submitted and would be delivered to recipients shortly.