Solved

Example of a Service Contract in XML format

Posted on 2006-06-28
2
300 Views
Last Modified: 2013-11-19
Can someone provide an example of a Service Contract in XML format?  Any example would be great that provides detail about a particular service and how to use it.


thanks
0
Comment
Question by:jhughes4
2 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 17007401
A service contract is nothing else than a common interface to exchange information, basically a common format or request/reply. You initiate a request based on specific format and you receive an answer, again, on specific format. An XML service contract is nothing else than an XSD file that XML will comply to. Have a look here: http://www.w3schools.com/schema/default.asp for an XSD tutorial.
0
 
LVL 10

Accepted Solution

by:
mukundha_expert earned 500 total points
ID: 17008403
>>Any example would be great that provides detail about a particular service and how to use it.
Consider the schema for the Customer XML,
it defines the rules for (schema ) your Customer XML,

for e.g,

the root element is the customer,

the customer can have name,age,ID among which name,ID shoould occur and age may occur

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified"
      xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="Customer">
            <xs:complexType>
                  <xs:sequence>
                        <xs:element name="name" minOccurs = "1" maxOccurs = "1" type="xs:string" />
                        <xs:element name="age" minOccurs = "0" maxOccurs = "1"  type="xs:integer" />
                        <xs:element name="ID" minOccurs = "1" maxOccurs = "1" type="xs:string" />
                  </xs:sequence>
            </xs:complexType>
      </xs:element>
</xs:schema>



<Customer>
<name> name </name>
<age>10</age>
<ID>1</ID>
</Customer>

<Customer>
<name> name </name>
<ID>1</ID>
</Customer>

above two are valid,

but

<Customer>
<age>10</age>
<ID>1</ID>
</Customer>

<Customer>
<name> name </name>
<age>10</age>
</Customer>

<Customer>
<age>10</age>
</Customer>
are invalid or do not follow the rule

if you are using a validating parser , it will analyse the xml whether it is adhering to the rules
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question