#!/usr/bin/perl -w

# Sample SOAP::Lite invocation of OneOutBox's free worldwide FAX service.

use SOAP::Lite;

my $service = SOAP::Lite
  ->service('http://www.OneOutBox.com/wsdl/FreeFaxService.wsdl');

# the recipient name can include spaces and returns; '/' maps to 
my $recipient = "FirstName LastName/MailStop 5";

# the text to be sent can be formatted, as shown in this example
my $text = "\n
FreeFax service provided through 1outBox (OneOutBox.com) and TPC.int.\n
\n
Enterprise software integration to the real world:\n
    A single interface to send physical FAX transmissions around the world.\n
    No equipment, phone lines, or server software to purchase or support.\n
    Flexible services that provide the capacity you need - when you need it.\n

Widely adopted Internet standard interface through Web Services:\n
    Simple SOAP interface to generate FAX transmissions.\n
    Platform-independent Web Services implementation.\n
    Sample client code provided using SOAP::Lite for Perl.\n
    Find details and Web Services Description Language at www.OneOutBox.com/freefax.\n
\n
Coverage and service quality may vary - FAX service is provided by\n
volunteers operating within each local service area.\n
\n
All free FAX transmissions will include a cover page including advertising\n
to support the volunteer operator.  This can not be changed.\n
\n
If you need higher services levels, guaranteed delivery, or prefer not to\n
have advertising on the cover page, please contact us for details on our\n
ProFax beta.\n
\n
Thank you for using the 1outBox FreeFAX.\n";

# package up the parameters for the SOAP call:
my @parameters = (
  SOAP::Data->name(Sender => 'user@domain'), # email required for delivery status
  SOAP::Data->name(ToNum => 14259442242), 	# fax phone number
  SOAP::Data->name(ToName => $recipient),	# name, as formatted above
  SOAP::Data->name(Text => $text)	# your text - see sample above
);

# invoke the Web Service
my $result = $service->SendFreeFAX(@parameters);

# check for success or failure
if ($result) {
	 print "\nSuccess: ", $result, "\n";	# result is message ID
} else {
	 print "Error in processing: " . $service->call->faultcode . 
		":" . $service->call->faultstring;
}

© 2002 OneOutBox