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

Re: [soaplite] Newbie, please help: Denied access to method

Expand Messages
  • Duncan Cameron
    ... You need to specify a SOAPAction somewhere in your WSDL file. I think that it needs to be an attribute on the soap:operation element
    Message 1 of 2 , Oct 18, 2004
      At 2004-10-18, 17:17:35 Bernd Prager <bernd@...> wrote:

      >
      >
      >Hi guys,
      >I'm trying to get my feet wet and I admit I have some serious trouble
      >understanding basics in describing web services. I hope somebody in
      >this list can point me in the right direction.
      >
      >I set up a simple test cgi script on my server:
      >
      >#!/usr/local/bin/perl -w
      >use strict;
      >use SOAP::Transport::HTTP;
      >
      >SOAP::Transport::HTTP::CGI
      > -> dispatch_to('Test')
      > -> handle;
      >
      >package Test;
      >
      >sub testLog {
      > my ($user, $action) = @_;
      > my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isday) =
      >localtime(time);
      > my $time = sprintf("%02d-%02d-%02d %02d:%02d:%02d", ($year%100),
      >$mon + 1, $mday, $hour, $min, $sec);
      > open(LOG, ">>test.log") || die "Unable to open logfile:$!\n";
      > print LOG $time . ": " . $user . ", " . $ENV{'REMOTE_ADDR'} . ", " .
      >$action . "\n";
      > close LOG;
      > return;
      >}
      >
      >Then I created a wsdl file:
      >
      ><?xml version="1.0" encoding="UTF-8"?>
      ><definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
      >xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      >xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
      >xmlns:xs="http://www.w3.org/2001/XMLSchema"
      >xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      >xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
      >xmlns:y="http://new.webservice.namespace"
      >targetNamespace="http://new.webservice.namespace">
      > <types>
      > <xs:schema/>
      > </types>
      > <message name="logMessage">
      > <part name="user" type="xs:string"/>
      > <part name="action" type="xs:string"/>
      > </message>
      > <portType name="testPort">
      > <operation name="testLog">
      > <input message="y:logMessage"/>
      > </operation>
      > </portType>
      > <binding name="testBinding" type="y:testPort">
      > <soap:binding style="rpc"
      >transport="http://schemas.xmlsoap.org/soap/http"/>
      > <operation name="testLog">
      > <soap:operation/>
      > <input>
      > <soap:body use="literal"/>
      > </input>
      > </operation>
      > </binding>
      > <service name="Test">
      > <port name="TestSoap" binding="y:testBinding">
      > <soap:address location="http://www.prager.ws/cg
      >i-bin/soapTest.cgi"/>
      > </port>
      > </service>
      ></definitions>
      >
      >When I now try to send a SOAP request to my server I get the error
      >message:
      >
      >Denied access to method (testLog) in class (main) at
      >/usr/local/lib/perl5/site_perl/5.8.4/SOAP/Lite.pm line 2267
      >
      >I don't know if it is the server script that denies access because I'm
      >doing something wrong there or my wsdl file is wrong.
      >
      You need to specify a SOAPAction somewhere in your WSDL file.
      I think that it needs to be an attribute on the soap:operation element

      <soap:operation soapAction="Test" />

      The SOAP action in effect gives the perl package in which the testLog() resides.

      Regards
      Duncan
    Your message has been successfully submitted and would be delivered to recipients shortly.