Iam having a problem with the permissions to a web service that I have created
I have the directory setup /var/www/cgi-bin and /var/www/html
In the cgi-bin directory I have a perl module Demo2.pm
package Demo2;
use strict;
use warnings;
=begin WSDL
_IN hi $string
_DOC This is a test soap web service that prints hi
_RETURN $string Returns a string containing hi
=end WSDL
sub hi {
my $out_xml = "hi";
return $out_xml;
}
1;
I am using Pod::WSDL to create a wsdl markup [wsdl.pl] contained in the same directory
#!/usr/bin/perl
use strict;
use warnings;
use Pod::WSDL;
my $pod = new Pod::WSDL(source => "./Demo2.pm",
location => '
http://localhost/cgi-bin/',
pretty => 1,
withDocumentation => 1);
print( $pod->WSDL );
When I run this file it gives me the wsdl output
<?xml version="1.0" encoding="UTF-8"?>
<!-- WSDL for
http://localhost/cgi-bin/ created by Pod::WSDL version: 0.05 on Mon Aug 25 21:55:05 2008 -->
<wsdl:definitions targetNamespace="
http://localhost/Demo2" xmlns:impl="
http://localhost/Demo2" xmlns:wsdlsoap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:tns1="
http://localhost/Demo2">
<wsdl:message name="hiRequest">
<wsdl:part name="hi" type="xsd:string" />
</wsdl:message>
<wsdl:message name="hiResponse">
<wsdl:part name="hiReturn" type="xsd:string">
<wsdl:documentation>Return
s a string containing hi</wsdl:documentation>
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Demo2Handler">
<wsdl:operation name="hi" parameterOrder="hi">
<wsdl:documentation>This is a test soap web service that prints hi</wsdl:documentation>
<wsdl:input message="impl:hiRequest" name="hiRequest" />
<wsdl:output message="impl:hiResponse" name="hiResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Demo2SoapBinding" type="impl:Demo2Handler">
<wsdlsoap:binding style="rpc" transport="
http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="hi">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="hiRequest">
<wsdlsoap:body encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/" namespace="
http://localhost/Demo2" use="encoded" />
</wsdl:input>
<wsdl:output name="hiResponse">
<wsdlsoap:body encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/" namespace="
http://localhost/Demo2" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Demo2HandlerService"
>
<wsdl:port binding="impl:Demo2SoapBin
ding" name="Demo2">
<wsdlsoap:address location="
http://localhost/cgi-bin/"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I store this in a directory as /var/www/html/service.wsdl
Now I create a SOAP::Lite client [wsdltest.cgi] in the /var/www/cgi-bin directory
that tries to retrieve the function
#!/usr/bin/perl -w
use SOAP::Lite;
my $wsdl = SOAP::Lite -> service("
http://localhost/service.wsdl");
my $result = $wsdl -> hi();
print $result;
print "\n";
If I type
http://localhost/service.wsdl it gives me the XML output that
describes the module.
When I run wsdltest.cgi it gives me the error
403 Forbidden at ./wsdltest.cgi line 4
This is odd because cgi/perl scripts do run fine in this directory.
The solution probably lies in where to put the Demo2.pm file in an
apache web server however I'm not sure.
Thanks
Start Free Trial