140 likes | 295 Views
Elements of a WSDL document. Web Service Definition Language (WSDL). A W3C standard XML document that describes three fundamental properties of a service: What it is - operations (methods) it provides. How it is accessed - data format, protocols.
E N D
Web Service Definition Language (WSDL) A W3C standard XML document that describes three fundamental properties of a service: • What it is - operations (methods) it provides. • How it is accessed - data format, protocols. • Where it is located - protocol specific network address.
Parts of a WSDL Document • Root definitions - namespaces • portType definitions - abstract definition of service • Message definitions - parameters in method signature • Type definitions - data types • Binding definitions - to protocols i.e. SOAP over HTTP • Service definitions - where service is, ports
Service Port Port Type Operation A Messages (input, output) Operation B Messages (input, output) Bindings Derived from “The Grid Core Technologies” by M. Li and M. Baker, Wiley, 2005.
port and service Describe “where” service is. • port - describes how a binding is deployed at the endpoint of a network • service - a named collection of ports
portType Describes “What” - an abstract definition of service operation. Compare to a Java interface. Uses the elements: • message definitions - a set of parameters referred to by method signature, decomposed into parts • type definitions - defines all data types used
Binding Describes “how” the elements in abstract interface (portType) are converted in actual data representations and protocols e.g. SOAP over HTTP. Could be more than one binding associated with a portType.
Math Web service For concreteness, let us consider the web service used in assignment 1. A simple version is: public class MyMath { public int squared(int x) { return x * x; } }
WSDL file for myMath service Namespaces <wsdl:message name="squaredRequest"> <wsdl:part name="in0" type="xsd:int"/> </wsdl:message> <wsdl:message name="squaredResponse"> <wsdl:part name="squaredReturn" type="xsd:int"/> </wsdl:message> <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Message definitions <wsdl:portType name="MyMath"> <wsdl:operation name="squared" parameterOrder="in0"> <wsdl:input message="impl:squaredRequest" name="squaredRequest"/> <wsdl:output message="impl:squaredResponse" name="squaredResponse"/> </wsdl:operation> </wsdl:portType> portType <wsdl:binding name="MyMathSoapBinding" type="impl:MyMath"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/ soap/http"/> <wsdl:operation name="squared"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="squaredRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/" namespace="http://DefaultNamespace" use="encoded"/> </wsdl:input> <wsdl:output name="squaredResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/" namespace="http://DefaultNamespace" use="encoded"/> </wsdl:output> </wsdl:operation> </wsdl:binding> Bindings Service definitions <wsdl:service name="MyMathService"> <wsdl:port binding="impl:MyMathSoapBinding" name="MyMath"> <wsdlsoap:address location="http://localhost:8080/axis/testaccount/ MyMath"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
Root Definitions Namespaces <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Service/Port Definitions Name of service Name of port <wsdl:service name="MyMathService"> <wsdl:port binding="impl:MyMathSoapBinding" name="MyMath"> <wsdlsoap:address location= "http://localhost:8080/axis/testaccount/MyMath"/> </wsdl:port> </wsdl:service> Where math service is located from Slide 3a14 Next slide
portType Definitions <wsdl:portType name="MyMath"> <wsdl:operation name="squared" parameterOrder="in0"> <wsdl:input message="impl:squaredRequest“ name="squaredRequest"/> <wsdl:output message="impl:squaredResponse“ name="squaredResponse"/> </wsdl:operation> </wsdl:portType> See next slide
Message Definitions <wsdl:message name="squaredRequest"> <wsdl:part name="in0" type="xsd:int"/> </wsdl:message> <wsdl:message name="squaredResponse"> <wsdl:part name="squaredReturn" type="xsd:int"/> </wsdl:message> Input message datatype Standard XML integer type Output message datatype Standard XML integer type Bindings
to slide 3a.10 Binding definitions <wsdl:binding name="MyMathSoapBinding" type="impl:MyMath"> <wsdlsoap:binding style="rpc“ transport= "http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="squared"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="squaredRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/> </wsdl:input> <wsdl:output name="squaredResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/> </wsdl:output> </wsdl:operation> </wsdl:binding> Bindings for messages