Web services
This presentation is the property of its rightful owner.
Sponsored Links
1 / 22

Web services PowerPoint PPT Presentation


  • 75 Views
  • Uploaded on
  • Presentation posted in: General

Web services. Prepared by: Intesar Ali IT Department PLA August 2010. XML. XML stands for e X tensible M arkup L anguage XML is designed to transport and store data. XML is a markup language much like HTML XML was designed to carry data, not to display data

Download Presentation

Web services

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Web services

Web services

Prepared by:

Intesar Ali

IT Department

PLA

August 2010

Palestinian Land Authority


Web services

XML

  • XML stands for eXtensible Markup Language

  • XML is designed to transport and store data.

  • XML is a markup language much like HTML

  • XML was designed to carry data, not to display data

  • XML tags are not predefined. You must define your own tags

    XML is used to encode all communications to a Web service

Palestinian Land Authority


Well formed xml documents

Well Formed XML Documents

  • XML documents must contain a root element. This element is "the parent" of all other elements.

  • <root> <child> <subchild>.....</subchild> </child></root>

  • XML tags are case sensitive

  • attributes provide additional information about elements:

  • XML Attribute Values Must be Quoted

  • <title lang="en">Everyday </title>

  • All XML Elements Must Have a Closing Tag

  • XML Elements Must be Properly Nested

  • <b><i>This text is bold and italic</i></b>

  • Comments in XML

  • <!-- This is a comment -->

  • XML Errors Will Stop You

Palestinian Land Authority


Xsd xml schema definition

XSD (XML Schema Definition)

An XML schema describes the structure of an XML document.

  • defines elements & attributes that can appear in a document

  • defines which elements are child elements & order , number of child elements

  • defines the defines whether an element is empty or can include text

  • defines default and fixed values 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

Palestinian Land Authority


Xsd the schema element

XSD - The <schema> Element

  • The <schema> element is the root element of every XML Schema

    <xsd:schema> … </xsd:schema>

  • <xsd:element name="lastname" type="xs:string"/ >

  • <xsd:attribute name="xxx" type="yyy"/>

Palestinian Land Authority


Web services

XML Schema for the Employee Information

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="Employee" minOccurs="0" maxOccurs="unbounded">

<xsd:complexType>

<xsd:sequence>

<xsd:element name="SSN="xsd:string>

<xsd:element name="Name" type="xsd:string"/>

<xsd:element name="DateOfBirth" type="xsd:date"/>

<xsd:element name="EmployeeType" type="xsd:string"/>

<xsd:element name="Salary" type="xsd:long"/>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:schema>

Case Study

Employee Information

SSNNameDateOfBirthEmployeeTypeSalary

XML document for the Employee Information

<?xml version="1.0" ?> -

<Employees >

<Employee>

<SSN>737333333</SSN>

<Name>ED HARRIS</Name>

<DateOfBirth>1960-01-01</DateOfBirth>

<EmployeeType>FULLTIME

</EmployeeType>

<Salary>4000</Salary>

</Employee>

</Employees>

Palestinian Land Authority


Web services1

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.

XML makes it easier to share data among different applications So Windows applications can talk with Unix applications.


A web service example

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:

    <%@ WebService Language="VBScript" Class="TempConvert" %>Imports SystemImports System.Web.ServicesPublic Class TempConvert :Inherits WebService<WebMethod()>

    Public Function HelloWorld( ByVal lcName As String) As String

    return "Hello World, " + lcName

    end function

    <WebMethod()>

    Public Function AddNumbers (ByVal lnNumber1 As decimal, ByVal lnNumber2As decimal) as decimal

    return lnNumber1 + lnNumber2

    end function <WebMethod()>

    public function GetServerTime() as DateTime

    return DateTime.Now

    end class

Palestinian Land Authority


Web service

Web Service

  • 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.

  • ASP.NET Automates the Process, you do not have to write your own WSDL and SOAP documents.

Palestinian Land Authority


Web services platform elements

Web Services Platform Elements

Web Services have three basic platform elements:

  • SOAP

  • WSDL

  • UDDI

Palestinian Land Authority


What is soap

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 is a communication protocol

  • SOAP is a format for sending messages

  • SOAP is designed to communicate via Internet

  • SOAP is platform independent

  • SOAP is language independent

  • SOAP is based on XML

  • SOAP allows you to get around firewalls

Palestinian Land Authority


Soap request

SOAP request

<?xml version="1.0"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope">

<soap:Body>

<AddNumbers xmlns="http://tempuri.org/">

<lnNumber1>6</lnNumber1>

<lnNumber2>4</lnNumber2>

</AddNumbers>

</soap:Body>

</soap:Envelope>

  • passing in the two provided parameters, which are properly converted into the types specified by the WSDL file.

Palestinian Land Authority


Soap response

SOAP response

<?xml version="1.0"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope">

<soap:Body>

<AddNumbersResponse xmlns="http://tempuri.org/">

<AddNumbersResult>10</AddNumbersResult>

</AddNumbersResponse>

</soap:Body>

</soap:Envelope>

Palestinian Land Authority


What is wsdl

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.

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.

Palestinian Land Authority


The wsdl document structure

A WSDL document describes a web service using these major elements:

<definitions>

<types>The data types used by the web service</types>

<message>The messages used by the web service </message>

<portType>The operations performed by the web service</portType>

<binding>The communication protocols used by the web service </binding>

Binding to SOAP

</definitions>

<http://www.mycompany.com/SampleWebService.asmx?wsdl>.

The WSDL Document Structure

Palestinian Land Authority


What is uddi

What is UDDI?

  • 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.

  • 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 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.

Palestinian Land Authority


There are two primary way to create web services in asp net

there are two primary way to create Web Services in ASP. net

.asmx file

You can use Windows Communication Foundation WCF to create web service to work with variety protocols like TCP

In asp.net 3.0


Testing the web service

Testing the Web Service

  • http://localhost/codeservice/firstwebservice.asmx

Palestinian Land Authority


Web services

Palestinian Land Authority


Calling the web service on the client side

Calling the Web Service on the client side

Palestinian Land Authority


2 adding a web reference

2- Adding a Web Reference

Palestinian Land Authority


Thank you

THANK YOU

Palestinian Land Authority


  • Login