SOAP Web Service Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
NumberToWords_SOAP_1_2.pl - SOAP::Lite for SOAP 1.2 Web Service
This section provides a tutorial example on how to use SOAP::Lite 0.710 to call a SOAP 1.2 Web service, NumberToWords, provided by at dataaccess.com
Enough hacking on the SOAP::Lite code, it's time to finalize my NumberToWords SOAP 1.2 client program. I decided to set DEFAULT_HTTP_CONTENT_TYPE constant to fix the media type issue.
#- NumberToWords_SOAP_1_2.pl #- Copyright (c) 2009 HerongYang.com. All Rights Reserved. # use SOAP::Lite; my $proxy = 'http://www.dataaccess.com/webservicesserver/NumberConversion.wso'; my $uri = 'http://www.dataaccess.com/webservicesserver/'; my $method = "NumberToWords"; my $soapAction = sub {return "$uri$method"}; my ($number) = @ARGV; #- Building the parameter element my $parameter = SOAP::Data ->name("ubiNum") # set the element name ->value($number); # set the value #- Creating the SOAP client object my $client = SOAP::Lite->new() ->soapversion('1.2') # set to SOAP 1.2 ->envprefix('soap12') # set prefix for SOAP 1.2 namespace ->default_ns($uri) # set the default namespace for method ->on_action($soapAction) # set the SOAPAction ->readable(true) # make the XML readable ->proxy($proxy); # set the proxy URL #- Calling the Web service my $som = $client->call($method=>($parameter)); my $output = $som->result; print $output . "\n";
When executing NumberToWords_SOAP_1_2.pl, I got this:
herong> NumberToWords_SOAP_1_2.pl 102 one hundred and two
The result is identical to NumberToWords_SOAP_1_1.pl developed previously.
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
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
Message Styles Supported in SOAP::Lite
Methods on SOAP::Lite Client Object
Testing SOAP::Lite Client Objects
Differences between SOAP 1.1 and SOAP 1.2
NumberToWords_localhost.pl - Testing on Local Host
soapversion('1.2') and envprefix('soap12') Must Used Together
default_ns() - Setting Namespace for Body Elements
SOAP::Data - Utility Class to Generate XML Elements
SOAPAction - Not Needed, But No Way to Remove It
►NumberToWords_SOAP_1_2.pl - SOAP::Lite for SOAP 1.2 Web Service
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