NumberToWords Worked - Setting Namespace and Parameter

This section provides a tutorial example on how to use the SOAP::Data class to build the request parameter element with correct namespace and correct element name.

To control the namespace of the SOAP body message, we need to:

Here is revised test program as

#- Copyright (c) 2005 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";

When executing, I got this:


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

<?xml version="1.0" encoding="UTF-8"?>
  <NumberToWords xmlns="">

SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x2e2d928)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Server: Microsoft-IIS/8.0
Content-Length: 352
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="">
   <m:NumberToWordsResult>one hundred and one </m:NumberToWordsResult>

Bingo! I got my first SOAP::Lite program working with NumberToWords Web service provided by

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

 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