SOAP 1.1 Request and Response of GetTemp

This section provides a tutorial example on how to use to send a SOAP 1.1 request for the GetSpeech Web service provided by

In the previous tutorial, I discovered a code bug in my socket test program, The bug is that the request file is opened in non-binary mode and the read() functions converts \r\n to \n resulting less bytes used in the SOAP request message.

I modified to open the request file in binary mode:

#- Copyright (c) 2005 All Rights Reserved.
   use Socket;
   ($host, $port, $in, $out) =  @ARGV;

#- Reading the request
   open(IN, "< $in");
   read(IN, $req, (-s $in));

#- Connecting
   connect(SOCK, sockaddr_in($port, inet_aton($host)));
   select(SOCK); $| = 1; select(STDOUT);

#- Sending the request
   print SOCK $req;

#- Receiving the response
   open(OUT, "> $out");
   while ($line=<SOCK>) {
      print OUT $line;

#- Closing connection

Here is the test result after fixing the bug:

herong> perl 80 \
   soap_1_1_GetSpeech.req soap_1_1.res

herong> more soap_1_1.res
HTTP/1.1 200 OK
Server: Apache/2.4.12 (Win32) PHP/7.0.2
X-Powered-By: PHP/7.0.2
Content-Length: 521
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
   <return xsi:type="xsd:float">51.2</return>

Cool. My first SOAP 1.1 test with worked nicely. Some notes on the SOAP response:

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 - Socket Level Testing Program

 Examples of HTTP 1.0 Requests and Responses

 Examples of HTTP 1.1 Requests and Responses

 SOAP 1.1 Request - Content-Length Too Small

 SOAP 1.1 Request - Content-Length Too Large

SOAP 1.1 Request and Response of GetTemp

 SOAP 1.2 Request and Response of GetTemp

 Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service

 Perl SOAP::Lite for SOAP 1.2 Web Services

 Perl SOAP::Lite for WSDL

 Python SOAP Client: Zeep

 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

 Archived Tutorials


 Full Version in PDF/EPUB