WSDL Tutorials - Herong's Tutorial Examples - v2.22, by Herong Yang
rpc/encoded Example - Get Exchange Rate
This section provides a tutorial example on writing a WSDL 1.1 example that uses SOAP 1.1 over HTTP with rpc/encoded as the message style and the encoding option.
"rpc/encoded" is the popular combination of message style and encoding option for most RPC (Remote Procedure Call) Web services. So let's write the second example with:
In this WSDL example, I want to send a SOAP request to call a RPC function to get an exchange rate. The function expects 3 input positional parameters and returns 1 value. So I wrote this WSDL document,
<?xml version="1.0"?> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:hy="https://www.herongyang.com/Service/" targetNamespace="https://www.herongyang.com/Service/"> <wsdl:documentation> GetExchangeRate_WSDL_11_SOAP_11_RPC.wsdl Copyright (c) 2007 HerongYang.com. All Rights Reserved. </wsdl:documentation> <wsdl:message name="getExchangeRateInputMessage"> <wsdl:part name="datePart" type="xsd:date"/> <wsdl:part name="fromCurrencyPart" type="xsd:string"/> <wsdl:part name="toCurrencyPart" type="xsd:string"/> </wsdl:message> <wsdl:message name="getExchangeRateOutputMessage"> <wsdl:part name="ratePart" type="xsd:decimal"/> </wsdl:message> <wsdl:portType name="getExchangeRatePortType"> <wsdl:operation name="GetExchangeRate"> <wsdl:input name="getExchangeRateInput" message="hy:getExchangeRateInputMessage"/> <wsdl:output name="getExchangeRateOutput" message="hy:getExchangeRateOutputMessage"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="getExchangeRateBinding" type="hy:getExchangeRatePortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="GetExchangeRate"> <soap:operation style="rpc" soapAction="https://www.herongyang.com/Service/getExchangeRate"/> <wsdl:input name="getExchangeRateInput"> <soap:body use="encoded" parts="fromCurrencyPart toCurrencyPart datePart"/> </wsdl:input> <wsdl:output name="getExchangeRateOutput"> <soap:body use="encoded" parts="ratePart"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="getExchangeRateService"> <wsdl:port name="getExchangeRatePort" binding="hy:getExchangeRateBinding"> <soap:address location= "https://www.herongyang.com/Service/GetExchangeRate.php"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
Note that:
See the next tutorial for testing requests and responses.
Table of Contents
WSDL 2.0 Document Structure and Syntax
WSDL Version 2.0 Part 2: Adjuncts
WSDL 2.0 Document Examples with SOAP Binding
Using WSDL Document in Java Apache Axis2/Java for WSDL
Apache Woden for WSDL Documents in Java
SoapUI - Web Service Testing Tool
WSDL 1.1 Document Structure and Syntax
WSDL 1.1 Binding Extension for SOAP 1.1
SoapUI as WSDL 1.1 Testing Tool
►WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles
SOAP 1.1 Message Styles and Encoding Options
document/literal Example - Guest Registration
Request and Response - Guest Registration
►rpc/encoded Example - Get Exchange Rate
Request and Response - Get Exchange Rate
SOAP Body and Operation Name - Book Reservation
Request and Response - Book Reservation
elementFormDefault="qualified" - Refill Order
Request and Response - Refill Order
encodingStyle="uri" for use="encoded"
Request and Response - Get Stock Price
PHP SOAP Extension for WSDL 1.1
Apache Axis2/Java for WSDL 1.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