Top Banner
1 WSDL: Web Service WSDL: Web Service Description Language Description Language Gary Sharp Gary Sharp Mike Breakiron Mike Breakiron
23

1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

Mar 30, 2015

Download

Documents

Abdiel Pauling
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

11

WSDL: Web Service WSDL: Web Service Description LanguageDescription Language

Gary SharpGary Sharp

Mike BreakironMike Breakiron

Page 2: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

22

OutlineOutline

What and whyWhat and why

WSDL document structureWSDL document structure

Sections and elementsSections and elements– types, messages, portTypes, bindings, and servicestypes, messages, portTypes, bindings, and services

NamespacesNamespaces

Demo1 – create a web service and its WSDL Demo1 – create a web service and its WSDL documentdocument

Demo2 – XMethods WSDL interpretationDemo2 – XMethods WSDL interpretation

WSDL referencesWSDL references

Page 3: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

33

What is WSDL?What is WSDL?

Web Service Description LanguageWeb Service Description Language

WSDL is a document written in XMLWSDL is a document written in XML

The document describes a Web serviceThe document describes a Web service

Specifies the location of the service and Specifies the location of the service and the methods the service exposesthe methods the service exposes

Page 4: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

44

Why WSDL?Why WSDL?

Without WSDL, calling syntax must be Without WSDL, calling syntax must be determined from documentation that must determined from documentation that must be provided, or from examining wire be provided, or from examining wire messages messages

With WSDL, the generation of proxies for With WSDL, the generation of proxies for Web services is automated in a truly Web services is automated in a truly language- and platform-independent way language- and platform-independent way

Page 5: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

55

Where does WSDL fit?Where does WSDL fit?

SOAP is the envelope containing the SOAP is the envelope containing the messagemessage

WSDL describes the serviceWSDL describes the service

UDDI is a listing of web services described UDDI is a listing of web services described by WSDLby WSDL

Page 6: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

66

Document StructureDocument Structure

Written in XMLWritten in XML

Two types of sections Two types of sections – Abstract and ConcreteAbstract and Concrete

AbstractAbstract sections define SOAP messages sections define SOAP messages in a platform- and language-independent in a platform- and language-independent manner manner

Site-specific matters such as serialization Site-specific matters such as serialization are relegated to the are relegated to the ConcreteConcrete sections sections

Page 7: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

77

Abstract DefinitionsAbstract Definitions

Types: Types: Machine- and language-Machine- and language-independent type definitions. independent type definitions. Messages: Messages: Contains function parameters Contains function parameters (inputs are separate from outputs) or (inputs are separate from outputs) or document descriptions. document descriptions. PortTypes: PortTypes: Refers to message definitions Refers to message definitions in Messages section that describe function in Messages section that describe function signatures (operation name, input signatures (operation name, input parameters, output parameters). parameters, output parameters).

Page 8: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

88

Concrete DescriptionsConcrete Descriptions

Bindings: Bindings: Specifies binding(s) of each Specifies binding(s) of each operation in the PortTypes section. operation in the PortTypes section.

Services: Services: Specifies port address(es) of Specifies port address(es) of each binding. each binding.

Page 9: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

99

OperationOperation

An An operationoperation is similar to a function in a is similar to a function in a high level programming languagehigh level programming language

A message exchange is also referred to as A message exchange is also referred to as an operation an operation

Operations are the focal point of Operations are the focal point of interacting with the serviceinteracting with the service

Page 10: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1010

Big PictureBig Picture

Page 11: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1111

An ExampleAn Example

<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>

This first line declares the document as an This first line declares the document as an XML document.XML document.

Not required, but helps the XML parser Not required, but helps the XML parser determine whether to parse the file or determine whether to parse the file or signal an errorsignal an error

Page 12: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1212

Types SectionTypes Section

The The typetype element defines the data types element defines the data types that are used by the web service. that are used by the web service. <xsd:complexType name="PERSON"><xsd:complexType name="PERSON"> <xsd:sequence> <xsd:sequence>

<xsd:element name="firstName“ <xsd:element name="firstName“ type="xsd:string"/> type="xsd:string"/>

<xsd:element name="lastName" <xsd:element name="lastName" type="xsd:string"/> type="xsd:string"/> <xsd:element name="ageInYears" <xsd:element name="ageInYears" type="xsd:int"/> type="xsd:int"/> </xsd:sequence> </xsd:sequence> </xsd:complexType></xsd:complexType>

Page 13: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1313

Messages SectionMessages Section

A A messagemessage element defines parameters element defines parametersThe name of an output message element ends The name of an output message element ends in "Response" by convention in "Response" by convention <message name="Simple.foo"> <message name="Simple.foo"> <part name="arg" type="xsd:int"/> <part name="arg" type="xsd:int"/> </message> </message>

<message name="Simple.fooResponse"> <message name="Simple.fooResponse"> <part name="result" type="xsd:int"/> <part name="result" type="xsd:int"/> </message> </message>

Page 14: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1414

PortTypes SectionPortTypes Section

Defines a web service, the operations that can be Defines a web service, the operations that can be performed, and the messages that are involved. performed, and the messages that are involved.

<portType name="SimplePortType"> <portType name="SimplePortType"> <operation name="foo" parameterOrder="arg" > <operation name="foo" parameterOrder="arg" > <input message="wsdlns:Simple.foo"/> <input message="wsdlns:Simple.foo"/> <outputmessage="wsdlns:Simple.fooResponse"/> <outputmessage="wsdlns:Simple.fooResponse"/>

</operation> </operation> </portType> </portType>

Page 15: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1515

Bindings SectionBindings Section

The The bindingbinding element defines the message element defines the message format and protocol details for each port.format and protocol details for each port.<operation name="foo"> <operation name="foo"> <soap:operation soapAction="http://tempuri.org/action/Simple.foo"/><soap:operation soapAction="http://tempuri.org/action/Simple.foo"/><input> <input> <soap:body use="encoded" <soap:body use="encoded" namespace="http://tempuri.org/message/" namespace="http://tempuri.org/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> </input> <output> <output> <soap:body use="encoded“ <soap:body use="encoded“ namespace="http://tempuri.org/message/“namespace="http://tempuri.org/message/“encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </output> </operation> </operation>

Page 16: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1616

The Port ElementThe Port Element

Each <port> element associates a location Each <port> element associates a location with a <binding> in a one-to-one fashion with a <binding> in a one-to-one fashion <port name="fooSamplePort" <port name="fooSamplePort" binding="fooSampleBinding"> binding="fooSampleBinding"> <soap:address <soap:address location="http://carlos:8080/fooService/foo.asp"/> location="http://carlos:8080/fooService/foo.asp"/>

</port> </port>

Page 17: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1717

Services SectionServices Section

A collection of related endpoints, where an A collection of related endpoints, where an endpoint is defined as a combination of a endpoint is defined as a combination of a binding and an address binding and an address <service name="FOOSAMPLEService"> <service name="FOOSAMPLEService"> <port name="SimplePort“ <port name="SimplePort“ binding="wsdlns:SimpleBinding">binding="wsdlns:SimpleBinding"><soap:address <soap:address location="http://carlos:8080/FooSample/ location="http://carlos:8080/FooSample/ FooSample.asp"/> FooSample.asp"/> </port> </port> </service> </service>

Page 18: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1818

An ExampleAn Example

<message name="Simple.foo"> <message name="Simple.foo"> <part name="arg" type="xsd:int"/> <part name="arg" type="xsd:int"/> </message> </message> <message name="Simple.fooResponse"> <message name="Simple.fooResponse"> <part name="result" type="xsd:int"/> <part name="result" type="xsd:int"/> </message> </message>

<portType name="SimplePortType"> <portType name="SimplePortType"> <operation name="foo" parameterOrder="arg" > <operation name="foo" parameterOrder="arg" > <input message="wsdlns:Simple.foo"/> <input message="wsdlns:Simple.foo"/> <output message="wsdlns:Simple.fooResponse"/> <output message="wsdlns:Simple.fooResponse"/> </operation> </operation> </portType> </portType> The above describes what kind of C/C++ function call?The above describes what kind of C/C++ function call? int foo(int arg); int foo(int arg);

Page 19: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

1919

NamespacesNamespaces

The purpose of namespaces is to avoid naming The purpose of namespaces is to avoid naming conflicts. conflicts. Imagine two complimentary web services, Imagine two complimentary web services, named A and B, each with an element named named A and B, each with an element named “foo”. “foo”. Each instance of foo can be referenced as A:foo Each instance of foo can be referenced as A:foo and B:fooand B:fooExample: "xmlns:xsd" defines a shorthand (xsd) Example: "xmlns:xsd" defines a shorthand (xsd) for the namespace for the namespace See See http://www.w3.org/2001/XMLSchemahttp://www.w3.org/2001/XMLSchema. .

Page 20: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

2020

DemoDemo

Create a web service and generate its Create a web service and generate its WSDL documentWSDL document

Page 21: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

2121

DemoDemo

Demo of XMethods WSDL interpretationDemo of XMethods WSDL interpretation

Page 22: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

2222

WSDL References [Primary]WSDL References [Primary]

http://msdn.microsoft.com/library/default.ahttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebsrv/html/wsdlesp?url=/library/en-us/dnwebsrv/html/wsdlexplained.aspxplained.asp

-a good overview of WSDL-a good overview of WSDL

http://msdn.microsoft.com/library/http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebsrv/default.asp?url=/library/en-us/dnwebsrv/html/understandWSDL.asphtml/understandWSDL.asp

-another good WSDL description-another good WSDL description

Page 23: 1 WSDL: Web Service Description Language Gary Sharp Mike Breakiron.

2323

http://www.xmethods.com/ve2/Tools.pohttp://www.xmethods.com/ve2/Tools.po

-WSDL analyzer-WSDL analyzer

http://soap.amazon.com/schemas2/http://soap.amazon.com/schemas2/AmazonWebServices.wsdlAmazonWebServices.wsdl

-Amazon’s WSDL document-Amazon’s WSDL document

http://api.google.com/GoogleSearch.wsdlhttp://api.google.com/GoogleSearch.wsdl

-Google’s WSDL document-Google’s WSDL document

WSDL References [Secondary]WSDL References [Secondary]