#!c:/perl/bin/perl.exe -w
use Apple;
use SOAP::Transport::HTTP;
my $soap = SOAP::Transport::HTTP::CGI
->dispatch_with({ 'http://my.website.com/Apple/foo/getanswer' => 'Apple' })
->on_action(sub { join '/foo/', @_; })
->dispatch_to('Apple')
->handle;
####
#!c:/perl/bin/perl.exe
package Apple;
use strict;
sub getanswer{
my ($self,$soap,$other) = @_;
return('Original soap message: '.$soap);
}
1;
####
use strict;
use SOAP::Lite +trace => 'debug';
$SOAP::Constants::PREFIX_ENV = "soapenv"; # Original: SOAP-ENV
$SOAP::Constants::PREFIX_ENC = "soapenc"; # Original: SOAP-ENC
my $ns_apple = "http://my.website.com/Apple";
my $host = "https://localhost/cgi-bin/apple_in.cgi";
# my $ns = "urn:apple";
my $cert = 'my_cert.cer';
$ENV{HTTPS_CERT_FILE} = $cert;
my $soap_req = '
';
my $soap = SOAP::Lite
->readable(1)
->on_action( sub { join '/foo/', @_ } )
# ->uri($ns)
->proxy($host)
->autotype(0);
my $som = $soap->call(SOAP::Data->name('apple:getanswer')
->attr({"xmlns:apple" => $ns_apple
})
=>SOAP::Data->type('xml' => $soap_req)
);
die $som->faultstring if ($som->fault);
my $res = $som->result;
print "The response from the server was:\n".$res."\n";
####
$soap_req =~ s/</g;
...
my $som = $soap->call(SOAP::Data->name('apple:getanswer')
->attr({"xmlns:apple" => $ns_apple
})
=>SOAP::Data->name('soap')
->type('xsd:string'=> $soap_req)
);