Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intesar G Ali IT DepartmentPalestinian Land Authority Web services Prepared by: Intesar Ali IT Department PLA August 2010.

Similar presentations


Presentation on theme: "Intesar G Ali IT DepartmentPalestinian Land Authority Web services Prepared by: Intesar Ali IT Department PLA August 2010."— Presentation transcript:

1 Intesar G Ali IT DepartmentPalestinian Land Authority Web services Prepared by: Intesar Ali IT Department PLA August 2010

2 Intesar G Ali IT DepartmentPalestinian Land Authority XML XML stands for eXtensible Markup Language XML stands for eXtensible Markup Language XML is designed to transport and store data. XML is designed to transport and store data. XML is a markup language much like HTML XML is a markup language much like HTML XML was designed to carry data, not to display data XML was designed to carry data, not to display data XML tags are not predefined. You must define your own tags XML tags are not predefined. You must define your own tags XML is used to encode all communications to a Web service XML is used to encode all communications to a Web service

3 Intesar G Ali IT DepartmentPalestinian Land Authority Well Formed XML Documents XML documents must contain a root element. This element is "the parent" of all other elements. XML documents must contain a root element. This element is "the parent" of all other elements........... XML tags are case sensitive XML tags are case sensitive attributes provide additional information about elements: attributes provide additional information about elements: XML Attribute Values Must be Quoted XML Attribute Values Must be Quoted Everyday Everyday All XML Elements Must Have a Closing Tag All XML Elements Must Have a Closing Tag XML Elements Must be Properly Nested XML Elements Must be Properly Nested This text is bold and italic This text is bold and italic Comments in XML Comments in XML XML Errors Will Stop You XML Errors Will Stop You

4 Intesar G Ali IT DepartmentPalestinian Land Authority XSD (XML Schema Definition) An XML schema describes the structure of an XML document. defines elements & attributes that can appear in a document defines elements & attributes that can appear in a document defines which elements are child elements & order, number of child elements defines which elements are child elements & order, number of child elements defines the defines whether an element is empty or can include text defines the defines whether an element is empty or can include text defines default and fixed values for elements and attributes defines default and fixed values for elements and attributes defines data types for elements and attributes defines data types for elements and attributes ex : The value of age cannot be lower than 0 or greater than 120 ex : The value of age cannot be lower than 0 or greater than 120

5 Intesar G Ali IT DepartmentPalestinian Land Authority XSD - The Element The element is the root element of every XML Schema The element is the root element of every XML Schema … …

6 Intesar G Ali IT DepartmentPalestinian Land Authority Employee Information SSN Name DateOfBirth EmployeeType Salary XML document for the Employee Information - - <Employee> 737333333 737333333 ED HARRIS ED HARRIS 1960-01- 01 1960-01- 01 <EmployeeType>FULLTIME</EmployeeType><Salary>4000</Salary></Employee></Employees> XML Schema for the Employee Information <xsd:complexType><xsd:sequence> </xsd:sequence></xsd:complexType> </xsd:schema> Case Study

7 Web Services By using Web services, your application can publish its function or message to the rest of the world. Web services use XML to code and to decode data, and SOAP to transport it. and SOAP to transport it. XML makes it easier to share data among different applications So Windows applications can talk with Unix applications.

8 Intesar G Ali IT DepartmentPalestinian Land Authority A Web Service Example In the following example we will use ASP.NET to create a simple Web Service that converts the temperature from Fahrenheit to Celsius, and vice versa: In the following example we will use ASP.NET to create a simple Web Service that converts the temperature from Fahrenheit to Celsius, and vice versa: Imports System Imports System.Web.Services Public Class TempConvert :Inherits WebService Imports System Imports System.Web.Services Public Class TempConvert :Inherits WebService Public Function HelloWorld( ByVal lcName As String) As String Public Function HelloWorld( ByVal lcName As String) As String return "Hello World, " + lcName return "Hello World, " + lcName end function end function Public Function AddNumbers (ByVal lnNumber1 As decimal, ByVal lnNumber2As decimal) as decimal Public Function AddNumbers (ByVal lnNumber1 As decimal, ByVal lnNumber2As decimal) as decimal return lnNumber1 + lnNumber2 end function end function public function GetServerTime() as DateTime return DateTime.Now end class

9 Intesar G Ali IT DepartmentPalestinian Land Authority Web Service Use "WebMethod()" to convert the functions in your application into web services: Use "WebMethod()" to convert the functions in your application into web services: Publish the.asmx file on a server with.NET support, and you will have your first working Web Service. Publish the.asmx file on a server with.NET support, and you will have your first working Web Service. ASP.NET Automates the Process, you do not have to write your own WSDL and SOAP documents. ASP.NET Automates the Process, you do not have to write your own WSDL and SOAP documents.

10 Intesar G Ali IT DepartmentPalestinian Land Authority Web Services Platform Elements Web Services have three basic platform elements : SOAP SOAP WSDL WSDL UDDI UDDI

11 Intesar G Ali IT DepartmentPalestinian Land Authority What is SOAP? SOAP is an XML-based protocol for exchanging information between computers over HTTP. Or more simple: SOAP is a protocol for accessing a Web Service. SOAP stands for Simple Object Access Protocol SOAP stands for Simple Object Access Protocol SOAP is a communication protocol SOAP is a communication protocol SOAP is a format for sending messages SOAP is a format for sending messages SOAP is designed to communicate via Internet SOAP is designed to communicate via Internet SOAP is platform independent SOAP is platform independent SOAP is language independent SOAP is language independent SOAP is based on XML SOAP is based on XML SOAP allows you to get around firewalls SOAP allows you to get around firewalls

12 Intesar G Ali IT DepartmentPalestinian Land Authority SOAP request 6 6 4 4 </soap:Envelope> passing in the two provided parameters, which are properly converted into the types specified by the WSDL file. passing in the two provided parameters, which are properly converted into the types specified by the WSDL file.

13 Intesar G Ali IT DepartmentPalestinian Land Authority SOAP response 10 10 </soap:Envelope>

14 Intesar G Ali IT DepartmentPalestinian Land Authority What is WSDL? WSDL is a document written in XML. A WSDL file describes all the methods and method signatures, as well as the namespaces and the handling URL for the Web Service. Visual Studio.NET uses the WSDL file to create a Web Reference on the client side from your Web Service. Visual Studio.NET uses the WSDL file to create a Web Reference on the client side from your Web Service. It reads the WSDL file and based on the definitions found in the WSDL file creates a proxy class that mimics the interface of the Web Service. Because this class is actually linked into your client project the class becomes available in IntelliSense and you can actually see the full interface of the class as you type.

15 Intesar G Ali IT DepartmentPalestinian Land Authority The WSDL Document Structure A WSDL document describes a web service using these major elements: A WSDL document describes a web service using these major elements:<definitions> The data types used by the web service The data types used by the web service The messages used by the web service The messages used by the web service The operations performed by the web service The operations performed by the web service The communication protocols used by the web service The communication protocols used by the web service Binding to SOAP Binding to SOAP</definitions><http://www.mycompany.com/SampleWebService.asmx?wsdl>.

16 Intesar G Ali IT DepartmentPalestinian Land Authority What is UDDI? UDDI stands for Universal Description, Discovery and Integration UDDI stands for Universal Description, Discovery and Integration The purpose of UDDI is to allow users to discover available web services and interact with them dynamically. The process can be divided into three phases: Searching (discovery), Binding, and Executing. The purpose of UDDI is to allow users to discover available web services and interact with them dynamically. The process can be divided into three phases: Searching (discovery), Binding, and Executing. UDDI is a directory service where companies can register and search for Web services. UDDI is a directory service where companies can register and search for Web services. UDDI is a directory for storing information about web services UDDI is a directory for storing information about web services UDDI is a directory of web service interfaces described by WSDL UDDI is a directory of web service interfaces described by WSDL UDDI is often compared to a telephone book's white, yellow, and green pages. The project allows businesses to list themselves by name, product, location, or the Web services they offer. UDDI is often compared to a telephone book's white, yellow, and green pages. The project allows businesses to list themselves by name, product, location, or the Web services they offer.

17 there are two primary way to create Web Services in ASP. net.asmx file.asmx file You can use Windows Communication Foundation WCF to create web service to work with variety protocols like TCP You can use Windows Communication Foundation WCF to create web service to work with variety protocols like TCP In asp.net 3.0

18 Intesar G Ali IT DepartmentPalestinian Land Authority Testing the Web Service http://localhost/codeservice/firstwebservice.asmx http://localhost/codeservice/firstwebservice.asmx

19 Intesar G Ali IT DepartmentPalestinian Land Authority

20 Intesar G Ali IT DepartmentPalestinian Land Authority Calling the Web Service on the client side

21 Intesar G Ali IT DepartmentPalestinian Land Authority 2- Adding a Web Reference

22 Intesar G Ali IT DepartmentPalestinian Land Authority THANK YOU


Download ppt "Intesar G Ali IT DepartmentPalestinian Land Authority Web services Prepared by: Intesar Ali IT Department PLA August 2010."

Similar presentations


Ads by Google