Calling PRC Methods Defined in WSDL 1.1 Documents

This section provides a tutorial example on how to call an RPC method defined a WSDL 1.1 document with SOAP 1.1 binding.

I think I am ready to write my first SOAP::Lite 0.710 client program to call my RPC method based Web service defined in the WSDL document, GetExchangeRate_WSDL_11_SOAP_11_RPC.wsdl. Here is an example Perl program, GetExchangeRate_Client.pl:

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

#- Loading the WSDL document
   my $client = SOAP::Lite->service(
      'file:///c:/herong/GetExchangeRate_WSDL_11_SOAP_11_RPC.wsdl');

#- Making the SOAP message in a readable format
   $client->readable('true');

#- Calling the RPC
   $result = $client->GetExchangeRate('USD', 'JPY', '2007-07-07');
   
#- Showing the result
   print "Exchange rate is: $result\n";

Notes on GetExchangeRate_Client.pl:

Here is the execution result of GetExchangeRate_Client.pl:

C:\herong\>GetExchangeRate_Client.pl
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
...
SOAP::Transport::HTTP::Client::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: GetExchangeRate SOAP::Data=HASH(0x1e2e...
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x...
SOAP::Transport::HTTP::Client::send_receive:
   POST http://www.herongyang.com/Service/GetExchangeRate.php HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 748
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.herongyang.com/Service/getExchangeRate"

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
    xmlns:hy="http://www.herongyang.com/Service/"
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <hy:GetExchangeRate>
<datePart xsi:type="xsd:date">USD</datePart>
<fromCurrencyPart xsi:type="xsd:string">JPY</fromCurrencyPart>
<toCurrencyPart xsi:type="xsd:string">2007-07-07</toCurrencyPart>
    </hy:GetExchangeRate>
  </soap:Body>
</soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0...
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: ...
Server: Apache
Content-Type: text/xml
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
X-Powered-By: PHP/4.4.9

<soapenv:Envelope
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:ser="http://www.herongyang.com/Service/">
  <soapenv:Header/>
  <soapenv:Body>
    <ser:GetExchangeRateResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <ratePart xsi:type="xsd:decimal">123.14</ratePart>
    </ser:GetExchangeRateResponse>
  </soapenv:Body>
</soapenv:Envelope>
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
SOAP::SOM::DESTROY: ()

Exchange rate is: 123.14

The result is good and bad:

Conclusion, SOAP::Lite 0.710 does not support the parts="..." of the "soap:body" WSDL statement.

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

 References

 PDF Printing Version