- Testing GetSpeech on Local Host

This section provides a tutorial example on how to generate the GetSpeech 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 all GetSpeech at

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

#- Copyright (c) 2009 by Dr. Herong Yang,
#- All rights reserved
   use SOAP::Lite +trace;
   my $client = SOAP::Lite->new()

   my $som = $client->call('GetSpeech', "To be, or not to be");

When executing, it will give this output:

POST http://localhost/WSShakespeare.asmx HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 485
Content-Type: application/soap; charset=utf-8
SOAPAction: "#GetSpeech"

<?xml version="1.0" encoding="UTF-8"?>
      <c-gensym3 xsi:type="xsd:string">To be, or not to be</c-gensym3>
500 Can't connect to localhost:80 (connect: Unknown error)

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

See sections below on how to fix these issues.

Last update: 2009.

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 Message Exchange Patterns

 SOAP HTTP Binding

 SOAP Perl Implementations

 SOAP PHP Implementations

 SOAP Java Implementations

 Perl SOAP::Lite - SOAP Server-Client Communication Module

 Perl Socket Test Program for HTTP and SOAP

 Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service

Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services

 Installing SOAP::Lite 0.710 to Support SOAP 1.2

 Features in SOAP::Lite 0.710

 Methods on SOAP::Lite 0.710 Client Object

 Testing SOAP::Lite Client Objects

 Request Differences between SOAP 1.1 and SOAP 1.2 - Testing GetSpeech on Local Host

 soapversion('1.2') and envprefix('soap12') Must Used Together

 default_ns() - Setting Default namespace for Body Elements

 SOAP::Data - Utility Class to Generate XML Elements

 SOAPAction - Not Needed, But No Way to Remove It

 Unsupported Media Type: "application/soap"


 content_type() method in the HTTP::Headers Class - SOAP::Lite for SOAP 1.2 Web Service

 Perl SOAP::Lite 0.710 for WSDL

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 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

 Web Services and SOAP Terminology


 PDF Printing Version