Solved

Example of a Service Contract in XML format

Posted on 2006-06-28
2
296 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now