System Programming and Design Concepts Year 3 Tutorial 08 1. Explain what is meant by a Web service. Web service is a application logic that is accessible using Internet standards. A SOA framework. SOA framework = RPC + SOA goals A software system which is designed to support interoperable machine to machine interaction over a network mainly follow SOA framework. 2. What are the elements of a Web Service? Transport (http) Encoding (XML) Standard Structure (SOAP) Description (WSDL) Discovery (UDDI - platform independent XML) 3. With the aid of a diagram explain the roles in a Web service. Service provider This is the provider of the web service. The service provider implements the service and makes it available on the Internet. This service can be implemented by any language, and it is exposed through an interface which is written in WSDL (Web Service Description Language). Service requestor This is any consumer of the web service. The requestor utilizes an existing web service by opening a network connection and sending an XML request. Service registry This is a logically centralized directory of services. The registry provides a central place where developers can publish new services or find existing ones. 4. Explain four standards associated with Web service technology. SOA (Service Oriented Architecture) WSDL (Web Service Description Language) SOAP (Simple Object Access Protocol ) UDDI (Universal Description, Discovery, and Integration)
5. Compare and contrast XSD and WSDL. XSD defines a schema which is a definition of how an XML document can be structured. You can use it to check that a given XML document is valid and follows the rules you've laid out in the schema. WSDL is an XML document that describes a web service. It shows which operations are available and how data should be structured to send to those operations. WSDL documents have an associated XSD that show what is valid to put in a WSDL document. 6. What is the advantage of using SOAP as the message format for a Web service? SOAP is a simple protocol that was developed for the compatibility with many different platforms and operating systems SOAP describes very simple XML-based packaging for sending messages. 7. What are WS* specifications? Give some examples. web Service standards and specifications are known as "WS-*". These represents a set of protocols and specifications. These are used to extend the capability of web service. WS-Security WS-Trust WS-Transaction... 8. Compare and contrast Web services and.net remoting as a distributed computing technique..net Remoting.NET Remoting works in a homogenous environment. A consuming application is also required to be in.net Faster than web services (Specially when using binary format).net Remoting applications can use the HTTP, TCP, and SMTP protocols Can be state full or stateless Web Services Web Services are platform and language independent Considered as slow in performance (Because of XML) XML Web Services use SOAP Stateless 9. What makes WCF significant compared to other RPC technologies? Service Orientation Interoperability Provide Service Metadata (meta data is a set of data that describes and gives information about other data. WCF services use service metadata to describe how to interact with the service's endpoints) Security, Transactions and Reliable and Queued Messages Multiple Transports and Encodings (HTTP, TCP,IPC / Binary, SOAP) Multiple options for hosting (Windows Service, Windows Forms & etc.)
10. What is meant by WCF 'ABC'? Performance Binary TCP.NET Remoting Interoperability HTTP SOAP Web Services End Point 1 Binary TCP End Point 2 HTTP SOAP WCF All communication with a WCF service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service. Each endpoint consists of four properties. Address - Indicates where the endpoint can be found. - The address uniquely identifies the endpoint and tells consumers where the service is located. Binding - Specifies how a client can communicate with the endpoint. - The transport protocol to use (ex :- TCP or HTTP). - The encoding to use for the messages (ex :- text or binary). - The necessary security requirements (ex:- SSL or SOAP message security). Contract - Identifies the operations available ( ServiceContract, OperationContract, DataContract, DataMember ) - What operations can be called by a client. - The form of the message. - The type of input parameters or data required to call the operation. - What type of processing or response message the client can expect. Behaviors - Specify local implementation details of the endpoint. WCF ABC means, Address, Binding and Contract.
11. Below is the C# Web Service named RandServer with one method called RandGen() that generates a random number (an integer) between [0..high] and returns it to the caller. The method has one parameter: int high. public class RandServer : System.Web.Services.WebService [WebMethod] Public int RandGen(int high) Random rand = newrandom(); return rand.next(0,high); Write the WSDL file for this Web service. You only need to write the first three (3) tags of the WSDL file out of five tags (<type>, <message> and <porttype>). 12. Write the method mentioned above in Q-11 as a WCF method. Write the WCF service contract named IRandWCFServer (which is in the Interface class) including the method RandGen(int high) (Service contract contains only the method definition). Implement the method in the backend file named RandWCFServer. [ServiceContract] public interface IRandWCFServer [OperationContract] int RandGen(int high); public class RandWCFServer : IRandWCFServer public int RandGen(int high) Random rand = new Random(); return rand.next(0,high);