You are on page 1of 5

Tunku Abdul Rahman College

Advanced Diploma in Science AACS5274 Web Services

Tutorial 3
1. Why is a service description necessary for representing Web services? Answer: Web services need to be described as we are developing service-based application (assemble the services). After described, WS can be published, discovered, assembled in a manageable hierarchy to deliver value-added service solution. Service description is typically used to making SOA loosely coupled. Service description is a machine-understandable specification describing the structure, operational characteristics, and non-functional properties of a Web service. It also specifies the wire format and transport protocol.

2.

What is the purpose of the Web Services Description Language (WSDL)? Answer: WSDL is the service representation language used to describe the details of the complete interfaces exposed by Web services and thus is the means to accessing a Web service. Through the service description, service provider can communication all the specs for invoking WS to the service requestor. WSDL is an XML-based specification schema for describing the public interface of a Web service. This interface include: Operational information relating to a Web service XML message protocols supported by a Web service Data type information for messages, binding information (specific protocol to be used) . Address information for locating the Web service. WSDL allows the specification for transmission under SOAP. Both service provider and service requestor must agree WS description and make use of that service. (a contract btw them) Essentially, WSDL is used to describe precisely what a service does, i.e. the operation the service provides, where it resides, i.e. details of the protocol address, e.g. URL. how to invoke it, i.e. details of the data formats and protocols necessary. Define and describe the Web service interface (abstract interface). Answer: The service interface definition describes the general Web service interface structure. 1. Data types - defining data types in the form of XML schemas or possibly other mechanism. 2. Message - present message as either as an entire document or arguments to be mapped to a method (WS) invocation. 3. Operation - the abstract definition of the operation for a message, such as naming a method, message queue, or business process, that will accept and process the message. 4. Port type - an abstract set of operations mapped to one or more end points (port), defining the collection of operations for a binding; the collection of operations, because it is abstract, can be mapped to multiple transports through various bindings.

3.

Page 1 of 5

4.

5.

6.

Define and describe the Web service implementation (concrete endpoint). Answer: The service implementation binds the abstract interface to a concrete network address, to a specific protocol, and to concrete data structure. a) Binding - the concrete protocol and data formats for the operations and messages defined for a particular port type. b) Port - a combination of a binding and a network address, providing the target address of the service communication. c) Service - a collection of related end points (port) encompassing the service definitions in the file; the services map the binding to the port and include any extensibility definitions. Can a single service contain multiple ports? What is the implication? Answer: Yes. It can contain multiple ports. A port identifies one or more transport binding for a given port type. Port types can be grouped for binding(s) which is how the services are connected over network. How does one-way operation differ from a request/response operation? Answer: One-way operation An operation in which the service endpoint receives a message, but does not send a response. E.g. a submission of an order to a purchasing system, no immediate response. Thought of as asynchronous messaging and defines only input message.

Request/response operation An operation in which the service endpoint receives a message and returns a message in response. (similar with RPC-style). <operation> element is declared with a <input> (indicates a WS receives a msg) and followed by a <output> (indicates a WS responds to the msg) element, it defines a request/response operation.

<! por tType ele ment d of a Web ser vice <wsdl:p ortTy pe n ame= <wsdl: opera tion name <wsdl :inpu t na me= Page 2 of 5 mess age= tns: e dr </ wsdl S natio :oper e n >

7.

How does a notification operation differ from a solicit/response operation? Answer: Notification operation An operation in which the service endpoint sends a message to a client, but it does not expect to receive a response. This type of messaging is used by services that need to notify clients of event e.g subscriber It contains an <output> element but no <input> message.

Solicit/response operation An operation in which the service endpoints sends message and expects to receive an answering message in response. (opposite of request/response operation) In this messaging pattern, the <portType> first declares <output> and then an <input> element. E.g service sends a order status to a client and receives back a receipt.

8.

With the aid of a diagram, explain how the WSDL architecture works. Answer:
1. Web Services administrator posts WSDL document to WSDL repository

XML Registry or WSDL Repository

2. Retrieve WSDL document

Notificati SOA P

Web Services
3. Invoke

Client

Role of a WSDL file in a Web services interaction: When a Web service is published, a Web service administrator posts a link to the Web services WSDL document in an XML registry /WSDL repository. The WSDL file is available when an application, such as SOAP client, searches a registry to locate a Web service. A client accesses the WSDL document in WSDL Repository to acquire information about the Web service and to create a SOAP message with the appropriate structure to communicate with the service. Then, using the information in the WSDL document, the client invokes

Solicit/response SOA P request SOA P respons

Sender

Page 3 of 5

Sender

the Web service.

9.

What TWO (2) purposes does the <binding> element serve? Answer: - The binding element links the abstract elements with the concrete elements of the WSDL. - It provides a container for information like protocol and address of the service.

10.

Based on the Web Services Description Language (WSDL) document given below, identify and explain each of the WSDL elements in detail.
1 <?xml version="1.0" encoding="utf-8" ?> 2 <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 3 xmlns:tns="http://tempuri.org/" 4 xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 5 targetNamespace="http://tempuri.org/" 6 <wsdl:types> 7 <s:element name="calculateSalary"> 8 <s:complexType> 9 <s:sequence> 10 <s:element minOccurs="1" maxOccurs="1" name="basic" type="s:int" /> 11 <s:element minOccurs="1" maxOccurs="1" name="OT" type="s:int" /> 12 </s:sequence> 13 </s:complexType> 14 </s:element> 15 <s:element name="calculateSalaryResponse"> 16 <s:complexType> 17 <s:sequence> 18 <s:element minOccurs="1" maxOccurs="1" name="Result" type="s:int" /> 19 </s:sequence> 20 </s:complexType> 21 </s:element> 22 </s:schema> 23 </wsdl:types> 24 <wsdl:message name="calculateSalarySoapIn"> 25 <wsdl:part name="parameters" element="tns:calculateSalary" /> 26 </wsdl:message> 27 <wsdl:message name="calculateSalarySoapOut"> 28 <wsdl:part name="parameters" element="tns:calculateSalaryResponse" /> 29 </wsdl:message> 30 <wsdl:portType name="ServiceSoap"> 31 <wsdl:operation name="calculateSalary"> 32 <wsdl:input message="tns:calculateSalarySoapIn" /> 33 <wsdl:output message="tns:calculateSalarySoapOut" /> 34 </wsdl:operation> 35 </wsdl:portType> 36 <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap"> 37 <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 38 <wsdl:operation name="calculateSalary"> 39 <soap:operation soapAction="http://tempuri.org/calculateSalary" 40 style="document" /> 41 <wsdl:input> 42 <soap:body use="literal" /> 43 </wsdl:input> 44 <wsdl:output> 45 <soap:body use="literal" /> 46 </wsdl:output> 47 </wsdl:operation> 48 </wsdl:binding> 49 <wsdl:service name="Service"> 50 <wsdl:port name="ServiceSoap" binding="tns:ServiceSoap"> 51 <soap:address location="http://localhost:WebSite/Service.asmx" /> 52 </wsdl:port> 53 <wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12"> 54 <soap12:address location="http://localhost:WebSite2/Service.asmx" /> 55 </wsdl:port> 56 </wsdl:service> 57 </wsdl:definitions>

Page 4 of 5

Page 5 of 5

You might also like