0% found this document useful (0 votes)
103 views18 pages

WSDL Reading, A Beginner's Guide

Web Services WSDL Guide

Uploaded by

PVParameswaran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views18 pages

WSDL Reading, A Beginner's Guide

Web Services WSDL Guide

Uploaded by

PVParameswaran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

14/06/2015

WSDLReading,aBeginner'sGuide

WSDLReading,aBeginner'sGuide

By:ThomasBayer
Date:08/24/2009
ThisarticleexplainshowtoreadaWSDLdocumentbyanalyzingtheWebServicesdescriptionofapublic
sampleService.DuringthearticleatreediagramisdevelopedfromthecontentoftheWSDLdocument.The
treeillustratesthestructureofWSDL.ThereaderwillgetanunderstandingoftheWSDLelementsandtheir
relationships.
TherootelementofaWSDLdocumentisdefinitions.SowestarttheWSDLtreewithadefinitionsnodeasroot.

Seefigure1:

Figure1:DefinitionandService
ToanalyseaWSDLdocumentitisrecommendedtoreaditfromthebuttomupwards.Atthebottomofthe
http://predic8.com/wsdlreading.htm

1/18

14/06/2015

WSDLReading,aBeginner'sGuide

BLZService'sWSDLwefindachildelementofdefinitionsnamedservice.
1
2
3
4
5
6
7
8
9
10
11

<wsdl:servicename="BLZService">
<wsdl:portname="BLZServiceSOAP11port_http"binding="tns:BLZServiceSOAP11Binding"
<soap:addresslocation="http://www.thomasbayer.com:80/axis2/services/BLZService
</wsdl:port>
<wsdl:portname="BLZServiceSOAP12port_http"binding="tns:BLZServiceSOAP12Binding"
<soap12:addresslocation="http://www.thomasbayer.com:80/axis2/services/BLZService
</wsdl:port>
<wsdl:portname="BLZServiceHttpport"binding="tns:BLZServiceHttpBinding">
<http:addresslocation="http://www.thomasbayer.com:80/axis2/services/BLZService
</wsdl:port>
</wsdl:service>

Listing1:ServiceElement
ThenameoftheserviceisBLZService.Aservicecanhavemultipleportsmarkedinfigure2witha*character.
Eachportdescribesawaytoaccesstheservice.InourBLZServiceexampletherearethreeports.Onefor
SOAP1.1,oneforSOAP1.2andonefortheHTTPbinding.

Figure2:PortsofaService
Let'shavealookatthefirstportinlisting2.
1
2

<wsdl:portname="BLZServiceSOAP11port_http"binding="tns:BLZServiceSOAP11Binding">
<soap:addresslocation="http://www.thomasbayer.com:80/axis2/services/BLZService"/>

http://predic8.com/wsdlreading.htm

2/18

14/06/2015

WSDLReading,aBeginner'sGuide

</wsdl:port>

Listing2:PortdescribingaSOAP1.1Endpoint
It'schildelementaddresshasadifferentXMLprefixthantheotherelements.Theprefixsoapisboundtothe
SOAP1.1bindinginthisdocument.InsteadoftheSOAPbindingotherbindingsforJMSorafiletransportcan
beused.Theaddresselementhasoneattributenamedlocationpointingtoanendpointaddressoftheservice.

Figure3:EndpointAddress
Tomoveon,wehavetolookatthebindingattributeoftheport.
Thevalue"tns:BLZServiceSOAP11Binding"pointstoabindingfurtherupinthedocument.Eachportispointing
toadifferentbindinginthisexample.AsaconsequencetheBLZServiceWSDLhasthreebindings.

http://predic8.com/wsdlreading.htm

3/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure4:APortreferencesaBinding
Abindingprovidesdetailsaboutaspecifictransport.Thebindinginfigure5hastwodifferenttypesofchildren.

Figure5:SOAPBinding
Firstwehavealookatthesoap:bindingelementinlisting3.ThevalueofthetransportattributeisanURIthat
indicatesthatSOAPmessagesshouldbesendoverHTTP.Thevalue"document"ofthestyleattributegivesus
aclueaboutthemessagestyletogetherwiththeuseattributeofthesoap:bodyelements.Inourexamplewe
haveaDocument/Literalmessagestyle.
Abindingcanspecifydifferenttransportoptionsforeachmethodofaservice.
1

<wsdl:bindingname="BLZServiceSOAP11Binding"type="tns:BLZServicePortType">

http://predic8.com/wsdlreading.htm

4/18

14/06/2015

2
3
4
5
6
7
8
9
10
11
12

WSDLReading,aBeginner'sGuide

<soap:bindingtransport="http://schemas.xmlsoap.org/soap/http"style="document"/>
<wsdl:operationname="getBank">
<soap:operationsoapAction=""style="document"/>
<wsdl:input>
<soap:bodyuse="literal"/>
</wsdl:input>
<wsdl:output>
<soap:bodyuse="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

Listing3:SOAP1.1Binding
Let'shavealookatlisting4.ThereyoucanfindtransportoptionsforthegetBankoperation.
Insidethewsdl:operationelementthereisasoap:operationelementatline2definingdetailsfortheSOAP
protocolanditstransport.ThesoapActionisareminiscentfromthepast.TheBasicProfileoftheWebServices
InteroperabilityOrganizationstipulatesthatthesoapActionshouldbeusedwithafixedvalueofanemptystring.
1
2
3
4
5
6
7
8
9

<wsdl:operationname="getBank">
<soap:operationsoapAction=""style="document"/>
<wsdl:input>
<soap:bodyuse="literal"/>
</wsdl:input>
<wsdl:output>
<soap:bodyuse="literal"/>
</wsdl:output>
</wsdl:operation>

Listing4:BindingOperation
BecauseWebServicessetthefocusonmessagesnotparameters,informationaboutthetransportofthese
messagescanbefoundinthewsdl:inputandwsdl:outputelement.Aservicemayspecifyoneorseveralfaults
asanalternativefortheoutput.
http://predic8.com/wsdlreading.htm

5/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure6:BindingOperation
Thesoap:bodyandsoap:headerelementscandescribeamessagefurther.Intheexamplethestyleisalways
literal.

http://predic8.com/wsdlreading.htm

6/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure7:soap:bodyElements
ItistimeagaintomoveupintheWSDL.Nowwefollowthevalueofthetypeattributeofthebinding.Itpointstoa
portTypewiththesamenamefurtherupinthedocument.

Figure8:BindingreferencingaPortType
Nowwehavecrossedtheborderfromtheconcretedetailsaboutthetransportandlocationofaservicetoits
pureabstractdescriptionofitsinterface.PortTypeisinWSDL1.1similartotheinterfaceoftheWebService.In
WSDL2.0thetermportTypeissubstitutedwiththeterminterface.
Aninterfacecanhaveseveraloperations.Anoperationcorrespondstoafunctioninproceduralprogramming.
TheWSDLoftheBLZServicehasonlyoneportType.AllofthethreebindingsrefertotheoneportTypenamed
BLZServicePortType.

http://predic8.com/wsdlreading.htm

7/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure9:OperationsofaportType
InsideaportTypewefindoperationelementsasinthebinding.Butthistimetheinputandoutputdescribethe
structureofthemessagesnottransportspecificoptions.

http://predic8.com/wsdlreading.htm

8/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure10:InputandOutputofanOperation
ThemessageattributeoftheinputrefersagainupintheWSDLdocument.Itreferstoamessagenamed
tns:getBank.Furtherupinthedocumentwefindacorrespondingmessagewiththisname.
1
2
3
4
5
6

<wsdl:portTypename="BLZServicePortType">
<wsdl:operationname="getBank">
<wsdl:inputmessage="tns:getBank"/>
<wsdl:outputmessage="tns:getBankResponse"wsaw:Action="http://thomasbayer.com/blz/B
</wsdl:operation>
</wsdl:portType>

Listing5:TheInterfaceDescriptionoftheService

http://predic8.com/wsdlreading.htm

9/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure11:Message
ThemessagegetBankhasonepartelementaschild.AWSDLspecialistwillrecognizethevalueoftheattribute
name,"parameters"indicatesthewrappersubstyleofthedocument/literalstyle.
1
2
3

<wsdl:messagename="getBank">
<wsdl:partname="parameters"element="tns:getBank"/>
</wsdl:message>

Listing6:getBankMessage
Theattributeelementatline2pointsagainfurtherup.Itreferstoanelementnamedtns:getBank.Wewillfind
thiselementinaXMLSchema.

http://predic8.com/wsdlreading.htm

10/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure12:AMessageanditsParts
Thenextchildofthedefinitionselementistypes.

http://predic8.com/wsdlreading.htm

11/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure13:TheTypesSection
ThetypeselementcanhavemultipleXMLschemasaschildren.

Figure14:SchemasusedinaWSDL
Listing7showsthetypeselementandanembeddedschema.
1
2
3
4
5
6
7
8
9
10
11

<wsdl:types>
<xsd:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"targetNa
<xsd:elementname="getBank"type="tns:getBankType"/>
<xsd:elementname="getBankResponse"type="tns:getBankResponseType"/>
<xsd:complexTypename="getBankType">
<xsd:sequence>
<xsd:elementname="blz"type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexTypename="getBankResponseType">
<xsd:sequence>

http://predic8.com/wsdlreading.htm

12/18

14/06/2015

12
13
14
15
16
17
18
19
20
21
22
23
24

WSDLReading,aBeginner'sGuide

<xsd:elementname="details"type="tns:detailsType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexTypename="detailsType">
<xsd:sequence>
<xsd:elementminOccurs="0"name="bezeichnung"type="xsd:string"/>
<xsd:elementminOccurs="0"name="bic"type="xsd:string"/>
<xsd:elementminOccurs="0"name="ort"type="xsd:string"/>
<xsd:elementminOccurs="0"name="plz"type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>

Listing7:EmbeddedXMLSchema
Inaschemawecanfindthedefinitionof:
complexTypes
simpleTypes
andthedeclerationof:
elements
TheXMLSchemainsideBLZServiceisatypicalschemausedforWebServicesthathasonlycomplexTypes
andelementsastoplevelschemacomponents.
Indocument/literalstyleallthepartspointtoelements.

http://predic8.com/wsdlreading.htm

13/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure15:APartcanreferenceanElement
Listing8showsthedeclarationofthegetBankelement.
1

<xsd:elementname="getBank"type="tns:getBankType"/>

Listing8:DeclarationoftheElementgetBank
ThetypeofthiselementisacomplexTypenamedgetBankTypedefindedsomewhereelseintheschema.

http://predic8.com/wsdlreading.htm

14/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure16:AnElementreferencesitsType
ThegetBankTypehasasequenceasmodulgroupcontainingoneelementnamedblzofthebuildinschematype
string.

http://predic8.com/wsdlreading.htm

15/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure17:AComplexTypewithaSequenceasContent
Listing9showsthedefinitionofthegetBankType.
1
2
3
4
5

<xsd:complexTypename="getBankType">
<xsd:sequence>
<xsd:elementname="blz"type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

Listing9:TheComplexTypegetBankType
AsequencecanconsistofseveralelementsthatdescribetheorderofelementsinaSOAPmessage.

http://predic8.com/wsdlreading.htm

16/18

14/06/2015

WSDLReading,aBeginner'sGuide

Figure18:TheentireStructureofaWSDLDocument
FinallywearethroughtheentireWSDLdescriptionofthesampleservice.
AllWSDLdocumentshavethesamestructureastheBLZService.TounderstandaWSDLstartreadingatthe
bottomandworkyourwayupbyfollowingtherightattributesasshowninthisarticle.
IhopethisarticlewashelpfultolearnhowtoreadaWSDLdocument.
ThomasBayer
[email protected]
References
WSDL1.1Specification
WSDL2.0Specification

http://predic8.com/wsdlreading.htm

17/18

14/06/2015

WSDLReading,aBeginner'sGuide

Copyright20082014predic8GmbH
Moltkestr.40,53173Bonn,Tel.+49(228)55525760

http://predic8.com/wsdlreading.htm

18/18

You might also like