chanakya has asked for the wisdom of the Perl Monks concerning the following question:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instanc +e" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <byName xmlns="Delivery"> <MessengerHeader> <Password>test-password</Password> <Username>Bannu</Username> <Action>New Ticket</Action> <Account>local-account</Account> </MessengerHeader> <TicketInformation> <createStatus>Private</createStatus> <AS>ABC 111 00</AS> <ISPCustomer>N</ISPCustomer> <Embargo>false</Embargo> </TicketInformation> </byName> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
#!/usr/local/bin/perl #CLIENT use warnings; use strict; use SOAP::Lite +trace => qw(debug); my $uri = 'Delivery'; #Data to be added to the request my (@data) = ( SOAP::Data->name(MessengerHeader => { Action => "New Tick +et", Username => "Bannu" +, Password => "test-p +assword", Account => "local-a +ccount" } ), SOAP::Data->name(TicketInformation =>{ createStatus => "P +rivate", ISPCustomer => "N" +, AS => "ABC 111 00" +, Embargo=>"false" } ) ); #Enable fault management globally use SOAP::Lite on_fault => sub { my($soap, $res) = @_; eval { die ref $res ? $res->faultstring : $soap->transport->stat +us }; return ref $res ? $res : new SOAP::SOM; }; #print $soap->fault ? $soap->faultstring. "\n" : $soap->result; my $soap = SOAP::Lite -> proxy('http://localhost/perl/soap-dbi.pl') -> serializer($serializer) -> uri($uri); my $res = $soap->byName(@data); #print $soap->retrieveDocument->result; print $res->fault ? $res->faultstring. "\n" : $res->result;
The following is the output from the server:#!/usr/local/bin/perl #SERVER use SOAP::Transport::HTTP; my $uri = 'Delivery'; SOAP::Transport::HTTP::CGI -> dispatch_to('Delivery') -> handle; package Delivery; use vars qw(@ISA); @ISA = qw(SOAP::Server::Parameters); sub byName { #Get the headers passed from the client my ($self, $in) = @_; my @input = %{$in}; foreach my $input (@input) { print $self . "==> " . $input, "\n"; } if ($input == 'New Ticket'){ & sendAcknowledgement(); } # send a response based on the <Action> value, currently not working sendAcknowledgement(); sub sendAcknowledgement { my (@response) = ( SOAP::Data->name(Acknowledgement =>{ createStatus => "O +K", Received => "0", } ) ); # use Data::Dumper; # print Dumper(@response); return map { $_ } %{$response}; }
Delivery==> test-password Delivery==> Action Delivery==> New Ticket Delivery==> Username Delivery==> Bannu Delivery==> Account Delivery==> local-account Status: 200 OK Content-Length: 388 Content-Type: text/xml; charset=utf-8 SOAPServer: SOAP::Lite/Perl/0.60 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instan +ce" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <byNameResponse xmlns="Delivery"><s-gensym15/></byNameResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: SOAP - Returning response from Server to Client request based on the <Action>
by jhourcle (Prior) on Apr 05, 2005 at 01:12 UTC | |
by chanakya (Friar) on Apr 06, 2005 at 10:30 UTC | |
by jhourcle (Prior) on Apr 06, 2005 at 11:23 UTC | |
by gellyfish (Monsignor) on Apr 06, 2005 at 11:37 UTC | |
Re: SOAP - Returning response from Server to Client request based on the <Action>
by rob_au (Abbot) on Apr 04, 2005 at 21:15 UTC |