test-password
Bannu
New Ticket
local-account
Private
ABC 111 00
N
false
####
#!/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 Ticket",
Username => "Bannu",
Password => "test-password",
Account => "local-account"
}
),
SOAP::Data->name(TicketInformation =>{
createStatus => "Private",
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->status };
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;
##
##
#!/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 value, currently not working
sendAcknowledgement();
sub sendAcknowledgement {
my (@response) = (
SOAP::Data->name(Acknowledgement =>{
createStatus => "OK",
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