NumberToWords Failed - Invalid namespace ""

This section provides a tutorial example on how to use the SOAP::Data class to build the request parameter element with correct element name. But the test failed with an error: Invalid namespace ''.

In the previous tutorial, I learned that the server does not like the parameter name "c-gensym3" generated with SOAP::Lite default setting.

What SOAP::Lite function should I use to fix this issue? Looking at the ActivePerl SOAP::Lite manual again, I found this class:

   You can use this class if you want to specify a value, a name, 
   atype, a uri or attributes for SOAP elements (use value(), name(), 
   type(), uri() and attr() methods correspondingly). For example, 
   SOAP::Data->name('abc')->value(123) will be serialized into 
   <abc>123</abc>, as well as will SOAP::Data->name(abc => 123). Each 
   of them (except the value() method) can accept a value as the 
   second parameter. All methods return the current value if you call 
   them without parameters. The return the object otherwise, so you 
   can stack them.

Based on the above description I revised my test program as

#- Copyright (c) 2018, All Rights Reserved.
   use SOAP::Lite +trace;
   my $client = SOAP::Lite->new();

#- Building the parameter element with name and namespace
   my $parameter = SOAP::Data

#- Calling the server
   my $som = $client->NumberToWords($parameter);
   my $output = $som->result;
   print $output . "\n";

Here is what I did in this program:

When executing, I got this:


SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x305cb20)
SOAP::Transport::HTTP::Client::send_receive: POST 
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 437
Content-Type: text/xml; charset=utf-8
SOAPAction: "#NumberToWords"

<?xml version="1.0" encoding="UTF-8"?>
            <ubiNum xsi:type="xsd:int">101</ubiNum>

SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x305ffc0)
   HTTP/1.1 500 Internal Server Error

Cache-Control: private, max-age=0
Connection: close
Server: Microsoft-IIS/8.0
Content-Length: 392
Content-Type: text/xml; charset=utf-8
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Methods: GET, POST
Client-Response-Num: 1
Strict-Transport-Security: max-age=31536000
Web-Service: DataFlex 18.1

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="">
      <faultstring>Error processing request: Invalid namespace '' 
expected ''</faultstring>

Too bad. The call fails again with a different error: Invalid namespace ''. SOAP::Lite is not setting any namespace for SOAP body message. I will try to fix the issue in the next tutorial.

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

 NumberToWords Failed - Unexpected Parameter "c-gensym3"

NumberToWords Failed - Invalid namespace ""

 NumberToWords Worked - Setting Namespace and Parameter

 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


 Full Version in PDF/EPUB