Using Operation Name as the SOAP Body Element Name

This section provides a tutorial example on how to define the first level sub element name as the operation name in the WSDL document to make SOAP::Lite happy.

In order to make SOAP::Lite happy, I wrote a new WSDL document that defines a Web service operation called "Reservation". The first level sub element of the SOAP Body is also defined with the same name "Reservation".

The new WSDL document is located at Reservation_WSDL_11_SOAP_11_Document.wsdl. Here is an example Perl program,, to test this Web service:

#- Copyright (c) 2009 by Dr. Herong Yang,
#- All rights reserved
   use SOAP::Lite +trace;

#- Loading the WSDL document
   my $client = SOAP::Lite->service(

#- Making the SOAP message in a readable format

#- Building sub elements for the request
   $member = SOAP::Data->name('Member')->value('Herong Yang');
   $item1 = SOAP::Data->name('Item')->value('Java Web Services');
   $item2 = SOAP::Data->name('Item')->value('SOAP Programming');
   $itemList = SOAP::Data->name('ItemList')
      ->value(\SOAP::Data->value($item1, $item2));

#- Calling the operation
   $result = $client->Reservation($member,$itemList);

#- Showing the result
   print "Result is: $result\n";

Execution result of

Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 761
Content-Type: text/xml; charset=utf-8
SOAPAction: ""

<?xml version="1.0" encoding="UTF-8"?>
      <Member xsi:type="xsd:string">Herong Yang</Member>
        <Item xsi:type="xsd:string">Java Web Services</Item>
        <Item xsi:type="xsd:string">SOAP Programming</Item>

HTTP/1.1 200 OK
Content-Type: text/xml


The SOAP Body in the request generated by SOAP::Lite matches the XML schema in the WSDL document now.

Last update: 2009.

Table of Contents

 About This Book

 Introduction to WSDL 2.0

 WSDL 2.0 Document Structure and Syntax

 WSDL Version 2.0 Part 2: Adjuncts

 WSDL 2.0 Document Examples with SOAP Binding

 WSDL 20 Programming APIs and Testing Tools

 Introduction to WSDL 1.1

 WSDL 1.1 Document Structure and Syntax

 WSDL 1.1 Binding Extension for SOAP 1.1

 soapUI 3.0.1 - Web Service Testing Tool

 WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles

 PHP SOAP Extension in PHP 5.3.1

Using WSDL in Perl with SOAP::Lite 0.710

 Introduction of Perl SOAP::Lite 0.710 for WSDL

 Methods on SOAP::Lite 0.710 Client Object

 Calling PRC Methods Defined in WSDL 1.1 Documents

 service() Method Returns New Objects

 SOAP::Data - XML Elements as Data Objects

 SOAP::Serializer - Converting Data Objects to XML

 Creating a Data Object for a Single XML Element

 Creating a Data Object for Nested XML Elements

 SOAP::Deserializer - Converting XML to Data Objects

 Calling XML Document Based Web Service

Using Operation Name as the SOAP Body Element Name

 Using WSDL Document in Java with Axis2 1.4.1

 Using WSDL2Java to Generate Web Service Stub Classes

 WSDL 1.1 Binding Extension for SOAP 1.2

 WSDL 1.1 and SOAP 1.2 Examples - Document and RPC Styles

 SOAP 1.2 Binding - PHP, Java and Perl Clients

 WSDL Related Terminologies


 PDF Printing Version