Outdated: SOAP 1.1 Request - Content-Length Too Small

This section provides a tutorial example of SOAP 1.1 request to use the GetSpeech Web service provided at xmlme.com. A 'Bad Request' error is received, if Content-Length is not enough to cover the entire XML message in the request.

Note that the "GetSpeech" Web service provided by xmlme.com is no longer available.

Now let's use my Perl socket test program to send a SOAP 1.1 request to a public Web service provided at xmlme.com.

xmlme.com provides a public Web service called GetSpeech with SOAP 1.1. GetSpeech reads a phrase from one of Shakespeare's plays from the request and returns speech, speaker, and play in the response. According to the instructions given at http://www.xmlme.com/WSShakespeare.asmx?op=GetSpeech, I prepared by first request sample, soap_1_1_GetSpeech.req:

POST /WSShakespeare.asmx HTTP/1.1
Host: www.xmlme.com
Content-Type: text/xml; charset=utf-8
Content-Length: 100
SOAPAction: "http://xmlme.com/WebServices/GetSpeech"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetSpeech xmlns="http://xmlme.com/WebServices">
      <Request>To be, or not to be</Request>
    </GetSpeech>
  </soap:Body>
</soap:Envelope>

Here is the response I got from my first test:

C:\herong>SocketRequestResponse.pl www.xmlme.com 80 
   soap_1_1_GetSpeech.req soap_1_1.res

C:\herong>more soap_1_1.res
HTTP/1.1 400 Bad Request
Connection: close
Date: ... 2009
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Length: 0

The "Bad Request" error was expected, because I put 100 as the "Content-Length" in the request. Here is my guess on what happened to this example:

Now I learned that HTTP servers do pay attention to the "Content-Length" header line in the request. I will provide a better value for "Content-Length" and try again in the next tutorial.

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 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

 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

 Outdated SOAP::Lite 0.55 in ActivePerl 5.8.7

Outdated: SOAP 1.1 Request - Content-Length Too Small

 Outdated: SOAP 1.1 Request - Content-Length Too Large

 Outdated: SOAP 1.1 Request and Response of GetSpeech

 Outdated: SOAP 1.2 Request and Response of GetSpeech

 Outdated: Calling GetSpeech SOAP 1.1 with SAAJ

 Outdated: Calling GetSpeech SOAP 1.2 with SAAJ

 References

 Full Version in PDF/EPUB