WSDL Tutorials - Herong's Tutorial Examples - v2.22, by Herong Yang
RPC Style Example - Get Stock Price
This section provides a tutorial example on writing a WSDL 2.0 example that uses SOAP 1.2 over HTTP with RPC as the message style.
My next WSDL 20 example was converted from the WSDL 1.1 version:
In this WSDL example, I want to send a SOAP request to call a RPC function to get a stock price. The function expects 3 input positional parameters and returns 1 value.
<?xml version="1.0"?> <wsdl:description xmlns:wsdl="http://www.w3.org/ns/wsdl" xmlns:wsoap= "http://www.w3.org/ns/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> GetStockPrice_WSDL_20_SOAP_12_RPC.wsdl Copyright (c) 2009 HerongYang.com. All Rights Reserved. </wsdl:documentation> <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="https://www.herongyang.com/Service/"> <xsd:element name="GetStockPrice"> <xsd:complexType> <xsd:sequence> <xsd:element name="Market" type="xsd:string"/> <xsd:element name="Stock" type="xsd:string"/> <xsd:element name="Date" type="xsd:date"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="GetStockPriceResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="Price" type="xsd:decimal"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:interface name="getStockPriceInterface"> <wsdl:operation name="GetStockPrice" pattern="http://www.w3.org/ns/wsdl/in-out" style="http://www.w3.org/ns/wsdl/style/rpc"> <wsdl:input messageLabel="In" element="hy:GetStockPrice#element"/> <wsdl:output messageLabel="Out" element="hy:GetStockPriceResponse#element"/> </wsdl:operation> </wsdl:interface> <wsdl:binding name="getStockPriceBinding" interface="hy:getStockPriceInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:version="1.2" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"> <wsdl:operation ref="hy:GetStockPrice" wsoap:mep="http://www.w3.org/2003/05/soap/mep/request-response"/> </wsdl:binding> <wsdl:service name="getStockPriceService" interface="hy:getStockPriceInterface"> <wsdl:endpoint name="getStockPriceEndpoint" binding="hy:getStockPriceBinding" address="https://www.herongyang.com/Service/GetStockPrice12.php"/> </wsdl:service> </wsdl:description>
See "Request and Response - Get Stock Price" 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
►RPC Style Example - Get Stock Price
IRI Style Example - Get Exchange Rate
Multiplart Style Example - Reservation
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
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