SOAP Web Service Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
SoapTcpClient.pl - 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, SoapTcpClient.pl, 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.
#- SoapTcpClient.pl #- Copyright (c) 2005 HerongYang.com. All Rights Reserved. use SOAP::Lite; # use SOAP::Lite +trace; my $client = SOAP::Lite->new(); $client->uri('urn:Hello'); $client->proxy('tcp://localhost:8001'); my $som = $client->hello("Herong"); my $output = $som->result; print $output . "\n";
Run SoapTcpClient.pl in another command window, while the SoapTcpServer.pl is running in the first window:
herong> perl SoapTcpClient.pl 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
Introduction to SOAP (Simple Object Access Protocol)
SOAP Message Transmission and Processing
SOAP MEP (Message Exchange Patterns)
PHP SOAP Extension Client Programs
PHP SOAP Extension Server Programs
PHP SOAP Web Service Example - getTemp
►Perl SOAP::Lite - SOAP Server-Client Communication Module
SOAP::Transport::TCP::Server - SOAP Server with TCP Protocol
►SoapTcpClient.pl - SOAP Client Example with TCP Protocol
SOAP::Transport::HTTP - SOAP Server with HTTP Protocol
Perl Socket Test Program for HTTP and SOAP
Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service
Perl SOAP::Lite for SOAP 1.2 Web Services
Java Socket and HttpURLConnection for SOAP
SAAJ - SOAP with Attachments API for Java
SoapUI - SOAP Web Service Testing Tool
WS-Security - SOAP Message Security Extension
WS-Security X.509 Certificate Token
Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service
Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services
Perl SOAP::Lite 0.710 for WSDL