GetSpeech Failed - Incorrect SOAPAction Header Line

This section provides a tutorial example on how to use a SOAP::Lite client to reach a Web service end point with the proxy parameter. But the test failed because of incorrect SOAPAction value.

In previous SOAP::Lite tutorials, we learned how to create a simple dummy SOAP server, create a simple SOAP client and make them work together.

Now let's try to write a SOAP::Lite client program to talk to a real Web service provided by This Web service is offered at with this description: "GetSpeech requires a string formatted phrase from one of Shakespeare's plays as input. The speech, speaker, and play will be returned as an XML string. Sample Shakespeare Phrases: To be, or not to be | ..."

Based on the above description I wrote my first version of

#- Copyright (c) 2009 All Rights Reserved.
#- All rights reserved
   use SOAP::Lite +trace;
   my $client = SOAP::Lite->new();
   my $som = $client->GetSpeech("To be, or not to be");
   my $output = $som->result;
   print $output . "\n";

When executed, I got this:

SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: GetSpeech To be, or not to be
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x...
Accept: text/xml
Accept: multipart/*
Content-Length: 479
Content-Type: text/xml; 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>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0...
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Connection: close
Date: ... 2009
Server: Microsoft-IIS/6.0
Content-Length: 1015
Content-Type: text/xml; charset=utf-8
Client-Date: ... 2009
Client-Response-Num: 1
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap=""
          Server did not recognize the value of HTTP Header 
            SOAPAction: #GetSpeech.
        at System.Web.Services.Protocols
      <detail />

Obviously, the Web service server failed with a "HTTP/1.1 500 Internal Server Error". It was actually caused by an exception in the Web service process: "System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: #GetSpeech." Here is my quick analysis of the problem:

One positive result of the test is that my test program did reach the Web service end point at: I will modify my program to provide SOAPAction correctly in the next tutorial.

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

 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

GetSpeech Failed - Incorrect SOAPAction Header Line

 GetSpeech Failed - Incorrect Parameter Name c-gensym

 Using Socket Program to Request Parameter Name

 GetSpeech Worked - Using SOAP::Data Class and on_action() Function - SOAP::Lite for 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