Presentation is loading. Please wait.

Presentation is loading. Please wait.

3d.1 More on XML XML Schema Definition Language (XSD)

Similar presentations


Presentation on theme: "3d.1 More on XML XML Schema Definition Language (XSD)"— Presentation transcript:

1 3d.1 More on XML XML Schema Definition Language (XSD)

2 3d.2 XML Schema Definition Language (XSD) Introduced in 2001 as a standard by W3C organization. Defines the XML schema, the base for all XML “languages” such as WSDL, WSDD, … Defines a set of predefined (built-in) types such as int, string. Provides a means of defining new data types. Describes the structure of XML documents.

3 3d.3 XSD XML Schema Definition Language. An XML schema for a particular application. Example WSDL schema Compare to a programming language, say Java. Compare to Java class definitions used for a particular application. A document conforming to a particular schema Example WSDL document for a service Compare to an object instance from above class

4 3d.4 Standard data types Correspond to “primitive” datatypes in a high level language. Specific sizes and form. Example type = xsd:int Such attributes would appear in an XML document to define the types of operands used when a a service is invoked.

5 3d.5 In an WSDL document, datatypes would appear in the message definitions:

6 3d.6 Complex datatypes Used to represent structured datatypes, similar to that of high level language. A structure is defined consisting of defined datatypes. Example

7 3d.7 Derived datatypes Can “derive data types from “primitive” datatypes, using one of three mechanisms, restriction, extension, and list. Example Can restrict a datatype to have certain values.

8 3d.8 From http://www.w3.org/ Built-in Built-in derived

9 3d.9 XML namespaces Purpose to prevent naming collisions in elements and attribute names 1. Must be a URI (often a URL), but only used as unique string. Example of a default namespace xmlns=“http://www.w3.org/2001/XMLSchema” Example of a namespace applied to certain names (using prexfix myns) xmlns:myns=“http://www.cs.uncc.edu/~abw/ns” 1. “Real World XML Web Services: For VB and VB.net Deveopers” by Y. Shohoud, online on http://www.learnxmlws.com.

10 3d.10 Assignment 1 WSDL example <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">

11 3d.11 Assignment 1 WSDL example <wsdl:definitions. xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdl=“http://schemas.xmlsoap.org/wsdl/” xmlns:wsdlsoap=“http://schemas.xmlsoap.org/wsdl/soap/” xmlns:xsd="http://www.w3.org/2001/XMLSchema". >

12 3d.12 <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"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/> Namespaces Message definitions portType Bindings Service definitions WSDL file for myMath service

13 3d.13 <wsdlsoap:binding style="rpc“ transport= "http://schemas.xmlsoap.org/soap/http"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/" namespace="http://DefaultNamespace" use="encoded"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/" namespace="http://DefaultNamespace" use="encoded"/> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" Sample places for WSDL namespace

14 3d.14 <wsdlsoap:binding style="rpc“ transport= "http://schemas.xmlsoap.org/soap/http"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/" namespace="http://DefaultNamespace" use="encoded"/> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/" namespace="http://DefaultNamespace" use="encoded"/> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" Sample places for SOAP namespace

15 3d.15 More on schemas One can create your own schema to match your web service application. Example Suppose you want to have purchase order system, with a schema for the invoices.

16 3d.16 Invoice schema Could save as file “Invoice.xsd”

17 3d.17 Purchase order <definitions name="InvoiceProcessing" … namespaces <xsd:import namespace="http://www.xmltc.com/railco/invoice/schema/" schemaLocation="Invoice.xsd"/> /xsd:schema> … bindings and sercive /ports


Download ppt "3d.1 More on XML XML Schema Definition Language (XSD)"

Similar presentations


Ads by Google