User Tools

Site Tools


kurs:soap

Client

use warnings;
use strict;

use SOAP::Lite; ##  +trace => 'debug';
use Getopt::Long;
use Data::Dumper;

my $opt  = {};

GetOptions($opt,
        'server=s',
        'command=s',
        'urn=s',
);

my $NS     = "urn:". ($opt->{urn} || "SOAPServer::Handler");
my $HOST = 'http://'.$opt->{server};

my $soap = SOAP::Lite
  ->readable(1)
  ->uri($NS)
  ->proxy($HOST);

my $soapd = new SOAP::Data->type(hash => $opt);

my $som = $soap->command($soapd);

#print Dumper $som;
print Dumper $som->result;

Server

httpd.conf

Listen 9876
<VirtualHost _default_:9876>
  ServerName     SOAP
  ErrorLog       /var/log/apache2/soap_error.log  ## funktioniert nur richtig wenn apache richtig kompiliert
  TransferLog    /var/log/apache2/soap_transfer.log
  <Location /soap>
        SetHandler perl-script
        PerlHandler Apache2::SOAP
        PerlSetVar dispatch_to SOAPServer::Handler
  </Location>

</VirtualHost>
package SOAPServer::Handler;

use SOAP::Lite;

sub command {
  my ($class, $soap_hash) = @_;
  $data = SOAP::Data->new;
  $data->type(hash => {result => 'wir gratinieren'});
  print STDERR "blafasel\n";
  return $data;
}

1;
kurs/soap.txt · Last modified: 2014/09/10 21:22 (external edit)