NumberToWords_localhost.pl - Testing on Local Host

This section provides a tutorial example on how to generate the NumberToWords request without using the real Web service server - Letting the connection fail with a localhost proxy URL.

Based on previous experience, I know that I need to run many tests while developing the SOAP 1.2 client program to call NumberToWords at dataaccess.com.

Instead of wasting resources at dataaccess.com, I will start my client program with a faked localhost end point to just generate the request message. So here is my first version, NumberToWords_localhost.pl:

#- NumberToWords_localhost.pl
#- Copyright (c) 2018 HerongYang.com, All Rights Reserved.
#
   use SOAP::Lite +trace;
   my $client = SOAP::Lite->new()
      ->soapversion('1.2')
      ->readable(true)
      ->proxy('http://localhost/NumberConversion.wso');

   my $som = $client->call('NumberToWords', 102);

When executing, it will give this output:

C:\herong>NumberToWords_localhost.pl
...
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x3034700)
SOAP::Transport::HTTP::Client::send_receive: 
   POST http://localhost/NumberConversion.wso HTTP/1.1
   
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 474
Content-Type: application/soap+xml; charset=utf-8
SOAPAction: "#NumberToWords"

<?xml version="1.0" encoding="UTF-8"?>
<Envelope
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Body>
    <NumberToWords>
      <c-gensym3 xsi:type="xsd:int">102</c-gensym3>
    </NumberToWords>
  </Body>
</Envelope>

SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x2c8efb8)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 404 Not Found
...

Not too bad. I was able to see the entire request without using a real Web service server. But:

See next tutorials on how to fix these issues.

Last update: 2018.

Table of Contents

 About This Book

 Introduction to Web Service

 Introduction to SOAP (Simple Object Access Protocol)

 SOAP Message Structure

 SOAP Message Transmission and Processing

 SOAP Data Model

 SOAP Encoding

 SOAP RPC Presentation

 SOAP Properties Model

 SOAP MEP (Message Exchange Patterns)

 SOAP HTTP Binding

 SOAP PHP Implementations

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 PHP SOAP Web Service Example - getTemp

 SOAP Perl Implementations

 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

 Perl SOAP::Lite for WSDL

 SOAP Java Implementations

 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

 Web Services and SOAP Terminology

 Outdated Tutorials

 References

 Full Version in PDF/EPUB