in reply to Re^4: Caturing incoming XML from SOAP server
in thread Caturing incoming XML from SOAP server
that is silly, so I leave you with this, I'm out
#!/usr/bin/perl -- use strict; use warnings; use Proc::Background; Main( @ARGV ); exit( 0 ); sub Main { my( $cos ) = @_; if( $cos ){ GoServer() if $cos == 1; GoClient() if $cos == 2; } else { GoGo(); } } sub GoGo { my $serv = Proc::Background->new( $^X, __FILE__, 1 => 'GoServer' ) +; sleep 1; my $cli = Proc::Background->new( $^X, __FILE__, 2 => qw'Go Client' + ); sleep 1; $cli->die; $serv->die; } sub GoServer { require MyModule; require SOAP::Transport::HTTP; SOAP::Lite->import( readable => 1 ); my $daemon = SOAP::Transport::HTTP::Daemon->new( LocalAddr => '127.0.0.1', LocalPort => 1203, Reuse => 1 ) ->dispatch_to('MyModule'); print "SOAP server started at ", $daemon->url, "\n"; $daemon->handle; } sub GoClient { require SOAP::Lite; SOAP::Lite->import( readable => 1, 'trace' => 'debug' ); my $soap = SOAP::Lite -> uri('http://127.0.0.1/MyModule') -> proxy('http://127.0.0.1:1203'); $soap->product_info_request("one","two","three"); } BEGIN { package MyModule; use strict; use warnings; require SOAP::Lite; require Data::Dump; SOAP::Lite->import( trace => 'debug', readable => 1 ); use vars qw(@ISA); @ISA = qw( SOAP::Server::Parameters ); sub product_info_request { #~ warn Data::Dump::pp( \@_ ); my $self = shift @_; my $envelope = pop @_; warn Data::Dump::pp( $envelope->body, ); warn Data::Dump::pp( '@_' ,\@_ ); warn Data::Dump::pp( '$envelope->context', $envelope->context, + ); warn Data::Dump::pp( '$envelope->context->request->content', $ +envelope->context->request->content, ); my ( @args ) = @_; return SOAP::Data->name('createRequestResponse')->value( SOAP::Data->name( 'requestNumber' => int(@args).' '."@args +" ) ); } BEGIN { $INC{'MyModule.pm'} = __FILE__; } 1; } __END__
|
|---|