WSDLDescribingWebServices2WhatisWSDL?•InordertocallaSOAPendpoint,youneedtoknow…–targetURL–valueofSOAPActionheader,ifrequired–requiredinput–whethertouseliteralinstancesofXSDtypesormessageformatsdefinedbySOAPencodingrules–SOAPdoesnotspecifyhowyougetthisinformation•WSDLmakesitpossibletodescribesuchdetails–WSDL=WebServiceDescriptionLanguage–amachine-consumableformat3XML1.0+NamespacesTheBasicWebServiceArchitectureXSDSOAPWSDLUDDIPortabletypesystemSerializedformFraming,protocolbindingEndpointdescriptionRegistryofendpointsWireprotocolsDescriptionlanguagesDiscoverymechanisms4WSDLStandardization•WSDL1.1isdefactostandardwithwideindustrysupport–today'sWebServicetoolkitssupportWSDL1.1–lotsofissuesexist,willshakeoutovertime–W3CWebServiceDescriptionWorkingGroupfocusedonrefininglanguage5StructureofaWSDLdefinition•WSDLdefinitionsrelyonsevenmajorconstructs:–aserviceimplementsasetofports–aportisaninstanceofabindingataparticularURL–abindingaddsprotocol-specificdetailstoaportType–aportTypedefinesasetofoperations–anoperationdefinesanexchangeofmessages–amessagedefinesadataformatintermsoftypes–atypedefinesthestructureofaportionofamessage6WSDLDefinitionTemplate•AWSDLdefinitionhasarootdefinitionselement–WSDLnamespace::definitionsxmlns:wsdl=:soap=:soap-rpc=:xsd=:xsdtns=urn:examples-org:math-typesxmlns:tns=urn:examples-org:mathtargetNamespace=urn:examples-org:math...!--definitionsgohere--.../wsdl:definitions7ServiceandPortwsdl:servicename=MathServicewsdl:portname=Service1Soapbinding=tns:MathServiceBindingsoap:addresslocation=:port/wsdl:service•Serviceelementspecifieshowthisservicecanbeaccessed–accesspointsdefinedviaportelements–aportmapsanaddresstoaparticularbinding–soap:addressspecifiesaSOAPaddress8Binding:ConcreteportTypeDetailswsdl:bindingname=MathServiceBindingtype=tns:MathServicePortTypesoap:bindingtransport==document/wsdl:operationname=Addsoap:operationsoapAction==document/wsdl:inputsoap:bodyuse=literal//wsdl:inputwsdl:outputsoap:bodyuse=literal//wsdl:output/wsdl:operation/wsdl:binding9Stylevs.Use•StyleattributespecifiesthestyleofSOAPmessage–document:nospecialformattingrules,whateverthesender/receiveragreeuponaheadoftime–rpc:messageusesSOAP'sRPCbindingrules•Useattributespecifiestheformatofthebody–literal:messagepartsserializedaccordingtoliteralXMLSchemadefinitions–encoded:messagepartsserializedaccordingtosomeencodingrules(likethosedefinedinSOAP1.1)•Document/literal,rpc/encodedmostcommoncombinations–WebMethodssupportdocument/literalbydefault–document/literalisthefuture10portTypeandOperation•AportTypedefinesalogicalsetofoperations–roughlyequivalenttoaninterfaceinCOM•Anoperationdefinesamessageexchangepattern(MEP)–theorderofchildinput/outputelementsdefinespatternwsdl:portTypename=MathServicePortTypewsdl:operationname=Add!--request/response--wsdl:inputmessage=tns:AddMessage/wsdl:outputmessage=tns:AddResponseMessage//wsdl:operation/wsdl:portType11MessageExchangePatterns•WSDLdefinesfourpossibleMEPs–request-response–solicit-response–one-way–notification•WebMethodsimplementrequest-responsebydefault–one-waypossibleusing[SoapDocumentMethod(OneWay)]12Messageswsdl:messagename=AddMessagewsdl:partname=parameterselement=xsdtns:Add//wsdl:messagewsdl:messagename=AddResponseMessagewsdl:partname=parameterselement=xsdtns:AddResponse//wsdl:message•Amessagedefinesadataformatintermsoftypes–supportsnon-XMLformatsinmessageparts–WS-Attachments,MIME,andDIMEmakethispossible•XML-basedmessagepartsdefinedintermsofXMLSchema13TypesDefineMessagePartStructurewsdl:typesxsd:schematargetNamespace=urn:examples-org:math-typesxsd:elementname=Addtype=xsdtns:Add/xsd:complexTypename=Addxsd:sequencexsd:elementname=n1type=xsd:int/xsd:elementname=n2type=xsd:int//xsd:sequence/xsd:complexTypexsd:elementname=AddResponsetype=xsdtns:AddResponse/xsd:complexTypename=AddResponsexsd:sequencexsd:elementref=soap-rpc:result//xsd:sequence/xsd:complexType/xsd:schema/wsdl:types14DerivingSOAPMessageFormatfromWSDLNamespaceoffirstchildofbodyContentmodeldefinedbyLocalnameoffirstchildofbodyXSDtargetNamespaceDefinedbyschemaXSDglobalelem.decl.Document/LiteralOperationnameWSDLtargetNamespaceorsoap:bodyDefinedbymsg.partsRpc/Encoded•Thewire-levelmessagediffersgreatlydependingonstyle/use–document/literaldrivencompletelybyXMLSchemadefinitions–rpc/encodeddrivenbyWSDLdefinitions(operationname,messageparts,andtargetNamespace)15WSDLIssues•WSDLhasissuesthatneedtoberesolved–languageisoverlycomplex–style/usedistinctionnotnecessary,possibleviaschema–nostandardwaytoconveyportType/operationinformationinSOAPmessage–needstodifferentiatetwooperationsbasedonsameXSDglobalelementdeclaration16.NETandWSDL•wsdl.exetoolmapsbackandf