Download - Wsdl and Soap
-
8/4/2019 Wsdl and Soap
1/25
Introduction toWSDL
-
8/4/2019 Wsdl and Soap
2/25
WhatYouShouldAlreadyKnow
Beforeyoucontinueyoushouldhaveabasic
understandingofthefollowing: XML
XMLNamespaces XMLSchema
-
8/4/2019 Wsdl and Soap
3/25
WhatisWSDL?
WSDLstandsforWebServicesDescription
Language WSDLiswritteninXML
WSDLisanXMLdocument WSDLisusedtodescribeWebservices
WSDLisalsousedtolocateWebservices WSDLisaW3Crecommendation
-
8/4/2019 Wsdl and Soap
4/25
WSDLDescribesWebServices
WSDLstandsforWebServicesDescription
Language. WSDLisadocumentwritteninXML.The
document
describes
a
Web
service.
It
specifies
thelocationoftheserviceandtheoperations
(ormethods)theserviceexposes.
-
8/4/2019 Wsdl and Soap
5/25
TheWSDLDocumentStructure
Element Defines
Thedatatypesusedbythewebservice
Themessagesusedbythewebservice
Theoperationsperformedbythewebservice
Thecommunicationprotocolsusedbythewebservice
-
8/4/2019 Wsdl and Soap
6/25
ThemainstructureofaWSDL
documentlookslikethis:
definitionoftypes........
definitionofamessage....
definitionofaport.......
definitionofabinding....
-
8/4/2019 Wsdl and Soap
7/25
WSDLPorts
The
elementisthemostimportant
WSDL
element. Itdescribesawebservice,theoperationsthatcanbeperformed,andthemessagesthatare
involved. Theelementcanbecomparedtoafunctionlibrary(oramodule,oraclass)ina
traditionalprogramminglanguage.
-
8/4/2019 Wsdl and Soap
8/25
WSDLMessages
The
elementdefinesthedata
elementsofanoperation. Eachmessagecanconsistofoneormore
parts.
The
parts
can
be
compared
to
the
parametersofafunctioncallinatraditional
programminglanguage.
-
8/4/2019 Wsdl and Soap
9/25
WSDLTypes
The
elementdefinesthedatatypes
thatareusedbythewebservice. Formaximumplatformneutrality,WSDLuses
XML
Schema
syntax
to
define
data
types.
-
8/4/2019 Wsdl and Soap
10/25
WSDLExample
-
8/4/2019 Wsdl and Soap
11/25
SOAP
-
8/4/2019 Wsdl and Soap
12/25
WhatisSOAP?
SOAPstandsforSimpleObjectAccessProtocol
SOAPisacommunicationprotocol
SOAPisforcommunicationbetweenapplications
SOAPisaformatforsendingmessages
SOAPcommunicatesviaInternet
SOAPisplatformindependent SOAPislanguageindependent
SOAPisbasedonXML
SOAPissimpleandextensible SOAPallowsyoutogetaroundfirewalls
SOAPisaW3Crecommendation
-
8/4/2019 Wsdl and Soap
13/25
WhySOAP?
ItisimportantforapplicationdevelopmenttoallowInternetcommunicationbetweenprograms.
Today'sapplicationscommunicateusingRemoteProcedureCalls(RPC)betweenobjectslikeDCOMandCORBA,butHTTPwasnotdesignedforthis.RPCrepresentsacompatibilityandsecurityproblem;firewallsandproxy
serverswillnormallyblockthiskindoftraffic. AbetterwaytocommunicatebetweenapplicationsisoverHTTP,becauseHTTPissupportedbyallInternetbrowsers
and
servers.
SOAP
was
created
to
accomplish
this. SOAPprovidesawaytocommunicatebetweenapplicationsrunningondifferentoperatingsystems,withdifferenttechnologiesandprogramminglanguages
SOAP B ildi Bl k
-
8/4/2019 Wsdl and Soap
14/25
SOAPBuildingBlocks
ASOAPmessageisanordinaryXMLdocumentcontainingthefollowingelements:
AnEnvelopeelementthatidentifiestheXMLdocumentasaSOAPmessage
A
Header
element
that
contains
header
information
ABodyelementthatcontainscallandresponseinformation
AFaultelementcontainingerrorsandstatusinformation
-
8/4/2019 Wsdl and Soap
15/25
SyntaxRules
Herearesomeimportantsyntaxrules:
A
SOAP
message
MUST
be
encoded
using
XML ASOAPmessageMUSTusetheSOAPEnvelopenamespace
ASOAPmessageMUSTusetheSOAPEncodingnamespace
ASOAPmessagemustNOTcontainaDTD
reference ASOAPmessagemustNOTcontainXMLProcessingInstructions
-
8/4/2019 Wsdl and Soap
16/25
...
... ...
-
8/4/2019 Wsdl and Soap
17/25
TheSOAPEnvelopeElement
TherequiredSOAPEnvelopeelementistherootelementofaSOAPmessage.ThiselementdefinestheXML
documentasaSOAPmessage. Example
... Messageinformationgoeshere ...
-
8/4/2019 Wsdl and Soap
18/25
SOAP Header Element TheoptionalSOAPHeaderelementcontains
applicationspecificinformation(likeauthentication,payment,etc)abouttheSOAP
message.
IftheHeaderelementispresent,itmustbethe
firstchildelementoftheEnvelopeelement.
Note: AllimmediatechildelementsoftheHeaderelementmustbenamespacequalified.
-
8/4/2019 Wsdl and Soap
19/25
soap:actor="http://www.w3schools.com/appml/">
... ...
-
8/4/2019 Wsdl and Soap
20/25
SOAPdefinesthreeattributesinthedefault
namespace("http://www.w3.org/2001/12/soap envelope").Theseattributesare:mustUnderstand,actor,andencodingStyle.
TheattributesdefinedintheSOAPHeader
defineshowarecipientshouldprocessthe
SOAPmessage.
-
8/4/2019 Wsdl and Soap
21/25
ThemustUnderstand Attribute TheSOAPmustUnderstand
attributecanbeused
toindicatewhetheraheaderentryismandatoryoroptionalfortherecipienttoprocess.
IfyouaddmustUnderstand="1"toachild
elementoftheHeaderelementitindicatesthat
thereceiverprocessingtheHeadermust
recognize
the
element.
If
the
receiver
does
not
recognizetheelementitwillfailwhenprocessing
theHeader.
-
8/4/2019 Wsdl and Soap
22/25
TheactorAttribute
ASOAPmessagemaytravelfromasenderto
a
receiver
by
passing
different
endpoints
alongthemessagepath.
However,notallpartsofaSOAPmessage
maybeintendedfortheultimateendpoint,instead,itmaybeintendedforoneormoreoftheendpointsonthemessagepath.
TheSOAPactorattributeisusedtoaddresstheHeaderelementtoaspecificendpoint.
-
8/4/2019 Wsdl and Soap
23/25
TheencodingStyle Attribute TheencodingStyle
attributeisusedtodefine
thedatatypesusedinthedocument.ThisattributemayappearonanySOAPelement,
anditwillapplytothatelement'scontents
andallchildelements.
ASOAPmessagehasnodefaultencoding.
-
8/4/2019 Wsdl and Soap
24/25
TheSOAPFaultElement
TheoptionalSOAPFaultelementisusedto
indicateerrormessages. IfaFaultelementispresent,itmustappearas
a
child
element
of
the
Body
element.
A
Fault
elementcanonlyappearonceinaSOAP
message.
The SOAP Fault element has the
-
8/4/2019 Wsdl and Soap
25/25
TheSOAPFaultelementhasthe
followingsubelements:
SubElement Description
Acodeforidentifyingthefault
Ahumanreadableexplanationofthefault
Informationaboutwhocausedthefaulttohappen
Holdsapplicationspecificerrorinformationrelatedto
theBodyelement