- SOAP Client Example with TCP Protocol

This section provides a tutorial example on how to use the SOAP::Lite module to create a SOAP client program,, with the TCP protocol.

SOAP:Lite represents the SOAP client API that allows you to send a Perl function call as a SOAP request to the specified SOAP server, and receive the result of the call as a SOAP response from the server. Main functions of SOAP::Lite are:

new() - Constructs a new SOAP::Lite object, and returns it.

uri('uri') - Defines the URI (Universal Resource Identifier) of the target module to be called, and returns the same object.

proxy('url') - Defines the URL (Universal Resource Locator) of the SOAP server, and returns the same object.

'method'() - Allows to call the method from the target module on the SOAP server, and returns a new SOAP::SOM object representing the outcome of the call.

$som->result - A property of a SOAP::SOM object representing the returning scalar value of the call.

Here is a sample program to show you how to use SOAP::LITE module to request a function call to the SOAP server I created in the previous section.

#- Copyright (c) 2002 by Dr. Herong Yang,
   use SOAP::Lite;
   # use SOAP::Lite +trace;
   my $client = SOAP::Lite->new();
   my $som = $client->hello("Herong");
   my $output = $som->result;
   print $output . "\n";

Run it while the is running, you will get:

Hello Herong

This is amazing. You can create a simple SOAP server and client in less than 20 lines of source code!

Note that the proxy URL must have "tcp" as the protocol name, since the SOAP server is running with TCP as the transportation protocol.

Table of Contents

 About This Book

 Perl on Linux Systems

 ActivePerl on Windows Systems

 Data Types: Values and Variables

 Expressions, Operations and Simple Statements

 User Defined Subroutines

 Perl Built-in Debugger

 Name Spaces and Perl Module Files

 Symbolic (or Soft) References

 Hard References - Addresses of Memory Objects

 Objects (or References) and Classes (or Packages)

 Typeglob and Importing Identifiers from Other Packages

 String Built-in Functions and Performance

 File Handles and Data Input/Output

 Open Files in Binary Mode

 Open Directories and Read File Names

 File System Functions and Operations

 Converting Perl Script to Executable Binary

 Using DBM Database Files

 Using MySQL Database Server

 Socket Communication Over the Internet

 XML::Simple Module - XML Parser and Generator

 XML Communication Model

SOAP::Lite - SOAP Server-Client Communication Module

 What Is SOAP?

 What Is SOAP::Lite?

 SOAP::Transport::TCP - SOAP Server with TCP Protocol - SOAP Client Example with TCP Protocol

 SOAP::Lite Tracing Functions

 SOAP::Transport::HTTP - SOAP Server with HTTP Protocol

 Perl Programs as IIS Server CGI Scripts

 CGI (Common Gateway Interface)

 XML-RPC - Remote Procedure Call with XML and HTTP

 RPC::XML - Perl Implementation of XML-RPC

 Integrating Perl with Apache Web Server Module for Building Web Pages

 LWP::UserAgent and Web Site Testing


 PDF Printing Version