This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
HTTP SOAP Code (Chapter 7)
|
397
The SOAP::Lite Client to Test FindBooks
This client is a simplified version of the first client, designed to test the FindBooks
method defined in the revised SOAP interface.
Example D-11. server-HTTP::Daemon-3
#!/usr/bin/perl -w
#
# The third version of the HTTP::Daemon-based server uses
# the SOAP layer with the FindBooks method in place of the
# two original search methods. Note that this will not
# correctly handle the authentication because of the
# coupling between the WishListCustomer::Daemon and the
# WishListCustomer::SOAP classes.
#
use strict;
use WishListCustomer::SOAP2;
use WishListCustomer::Daemon;
my $port = pop(@ARGV) || 9000;
my $host = shift(@ARGV) || 'localhost';
WishListCustomer::Daemon
->new(LocalAddr => $host, LocalPort => $port,
Reuse => 1)
->dispatch_with({ 'urn:/WishListCustomer' =>
'WishListCustomer::SOAP2' })
->objects_by_reference('WishListCustomer::SOAP2')
->handle;
exit;
Example D-12. client-wishlist-2
#!/usr/bin/perl -w
#
# This sample client is much simpler than the previous one,
# as it is only intended to demonstrate the flexibility of
# having the single-entry search interface that uses the
# parameter name to help in forming the search.
#
use strict;
use SOAP::Lite;
my ($type, $string) = (shift, shift);
die "USAGE: $0 { author | title } pattern [ endpoint ]\n"
unless ($type and $string);

Get Programming Web Services with Perl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.