Tutorials to .com

Tutorials to .com » Dotnet » Webservice » Description and registration, publish Web services (((ok the switch over)))

Description and registration, publish Web services (((ok the switch over)))

Print View , by: iSee ,Total views: 7 ,Word Count: 2794 ,Date: Sat, 23 May 2009 Time: 9:08 AM

framework for Web Service: description and registration, publish Web services




Content:

Example SOAP message
xml Schema Modeling
WSDL Service Description
Brief summary of UDDI service release About the author


Related Content:

Interface, Web service definition of the core of real Web services applications based on Web services, solutions and development platform for Web services what is?
Why do we need Web services?
WSDL: describes your Web service
UDDI registration data model




CHAI Xiao-Lu (fennivel@uddi-china.org)
Chief system Architect
September 20, 2001

This is the Web services architecture of the sixth article of the series of articles, also the last one, the text before the text is based on the previous application on the basis of a study published Web services interface, the whole process: xml Schema modeling, WSDL Release and the UDDI registration. Through this article, we can be detailed and specific understanding of the various xml and Web Service a series of norms in the release of Web Service from the left and right when the Web Service technology will also have an in-depth understanding.
Previous article, I have introduced, Web services are invoked through the SOAP message, carried out through the interface described in WSDL, and UDDI public through the registration issued. The previous article, I have introduced how the news of the definition of SOAP API, so in this article, I will just take the save_category raised to see the realization of specific, it should be how to use this information for W3C XML Schema modeling, if you use the WSDL will be based on the source Web service calls and to standardize the description of the delivery of the caller, as well as how the Web services standardization, together with its description of the WSDL file published in the UDDI registry to. Hope that we can explain the examples in this article, the last in this series of complete understanding of Web services, working principle and the role of the relevant technical specifications.

resources mainly include two categories of services is the Web site of the technical resources, including a large number of Web services, technical information, and the other is Web services "stack" series of technical specifications, they are a technical system, including UDDI, SOAP, WSDL, XML Schema, XML and so on. Finally, this article links to these resources, interested readers can find these resources link the content.

Example SOAP message

The following is a call save_category example, in the example of the use of the SOAP HTTP Binding (use of SOAP specification version 1.2), assuming that the target Web service is deployed in www.sagitta.com, and call the Web service will be the location of the entrance http://www.sagitta.com/catalog/.

In this message, will be in an existing category to add a new category and a new product.


POST / catalog HTTP/1.1
Content-Type: text / xml; charset = "utf-8"
Content-Length: nnnn
SOAPAction: "http://www.sagitta.com/catalog/"
Host: www.sagitta.com

<? xml version = "1.0" encoding = "UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/06/soap-envelope">
<env:Body>
<save_category xmlns="http://www.sagitta.com/schema/">
<authInfo> 5Az784kJceHCE982eB </ authInfo>
<category categoryKey="cb4e17d1-6100-47f6-a532-cd9cbd30c073" parentCategoryKey="ab4e3de1-7865-f2c1-b49a-beccbd21c072">
<name> Consumer Electronics </ name>
<description> Product Category for Consumer Electronics </ description>
<category categoryKey="" parentCategoryKey="cb4e17d1-6100-47f6-a532-cd9cbd30c073">
<name> SONY Consumer Electronics </ name>
<description> Sony's Product Category for Consumer Electronics </ description>
</ category>
<product productKey="" parentCategoryKey=" cb4e17d1-6100-47f6-a532-cd9cbd30c073">
<name> DSC-S75 digital Camera </ name>
<description> Sony's Brand-New Professional Digital Camera </ description>
<compliantSpecBag>
<specification specificationKey="Key[USB1.1]" />
</ compliantSpecBag>
<featureBag>
<feature> ... ... </ feature>
<feature> ... ... </ feature>
</ featureBag>
<parameterBag>
... ...
</ parameterBag>
</ product>
</ category>
</ save_category>
</ env: Body>
</ env: Envelope>




The call information may be returned to the news:

HTTP/1.1 200 OK
Content-Type: text / xml; charset = "utf-8"
Content-Length: nnnn

<? xml version = "1.0" encoding = "UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/06/soap-envelope">
<env:Body>
<categoryList xmlns="http://www.sagitta.com/schema/">
<category categoryKey="cb4e17d1-6100-47f6-a532-cd9cbd30c073" parentCategoryKey="ab4e3de1-7865-f2c1-b49a-beccbd21c072">
<category categoryKey="8933aa50-3aaf-11d5-80dc-002035229c64" parentCategoryKey="cb4e17d1-6100-47f6-a532-cd9cbd30c073" />
<product productKey="89307600-3aaf-11d5-80dc-002035229c64" parentCategoryKey="cb4e17d1-6100-47f6-a532-cd9cbd30c073" />
</ category>
</ categoryList>
</ env: Body>
</ env: Envelope>




We can see that two elements save_category and categoryList have brought back a xmlns modification "http://www.sagitta.com/schema/". URI said that only the element and all its sub-elements of the namespace. At the same time, these elements can be the URL of the Schema definition.

W3C XML Schema using the XML document described in the definition of the model in the Web services technology in a series, the status of support tools. W3C XML Schema are XML documents of any type of modeling tools. In the Web service system, whether expressed in the SOAP message or in the WSDL interface description, XML Schema is an important and indispensable tools and the underlying support.

I started from the XML Schema for save_category the news (at the same time corresponds to a service entrance), describes how each of our XML Schema to XML information modeling, how to use WSDL to the service entrance to save_category interface description, and then the entrance Published in the UDDI registry to.

XML Schema Modeling

XML Schema document is the suffix. Xsd documents in an XML Schema definition is generally divided into two parts, type (Type) the definition and elements (Element) definition. Now we combine save_category specific XML Schema definition to illustrate how to use the XML Schema definition to achieve the model.

In the following XML Schema document type definition includes: compliantSpecBag, featureBag, parameter, parameterBag, product and category six types, and this element is defined as an element save_category.

save_category description of the XML Schema definition of: (a complete XML Schema document is: sagitta.xsd)


<? xml version = "1.0" encoding = "UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">




These are the first XML Schema document.


<xs:complexType name="compliantSpecBag">
<xs:sequence>
<xs:element name="specification" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="specificationKey" type="xs:string" use="required"/>
</ xs: extension>
</ xs: simpleContent>
</ xs: complexType>
</ xs: element>
</ xs: sequence>
</ xs: complexType>




Schema in this description, describes the element types compliantSpecBag, any use of compliantSpecBag types of elements can contain elements of the specification, this element can appear 0 to infinite time (unlimited, in fact, could not have infinite time), and specification of the elements contained in an attribute specificationKey, the property is necessary, at the same time as the string type (xs: string). xs namespace is the W3C XML Schema 2001 namespace (namespace).


<xs:complexType name="featureBag">
<xs:sequence>
<xs:element name="feature" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</ xs: sequence>
</ xs: complexType>




Here, the element describes the type of featureBag, any type of document featureBag element can contain sub-elements are feature, and feature elements that can appear 0 to infinite time (unlimited, in fact, could not have infinite time). The content of element type is string (xs: string).


<xs:complexType name="parameter">
<xs:sequence>
<xs:element name="keyName" type="xs:string"/>
<xs:element name="keyValue" type="xs:string"/>
</ xs: sequence>
</ xs: complexType>

<xs:complexType name="parameterBag">
<xs:sequence>
<xs:element name="parameter" type="parameter" minOccurs="0" maxOccurs="unbounded"/>
</ xs: sequence>
</ xs: complexType>




Here the first parameter of the element describes the type, any type of document elements parameter can contain two sub-elements keyName and keyValue, they are sub-elements must appear at the same time only once. They are the type of string (xs: string). And then describes the elements parameterBag type, any type of document parameterBag element can contain sub-elements parameter, and this is the type of sub-elements previously defined parameter (in XML Schema, the element type name and the domain name space is orthogonal do not take into account any duplication of names), parameter of the number of elements there can be from 0 to infinite times.


<xs:complexType name="product">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="compliantSpecBag" type="compliantSpecBag"/>
<xs:element name="featureBag" type="featureBag"/>
<xs:element name="parameterBag" type="parameterBag"/>
</ xs: sequence>
<xs:attribute name="productKey" type="xs:string" use="required"/> <xs:attribute name="parentCategoryKey" type="xs:string" use="required"/>
</ xs: complexType>




Here describes the elements of the type of product, product type of any document element can contain sub-elements are the name, description, compliantSpecBag, featureBag, parameterBag. name and description of the type of element is xs: string. And compliantSpecBag, featureBag, parameterBag the type of all this off by looking at the definition of XML Schema can also be found very clearly in front of the definition refers to the definition of these types. Any type of document elements of product there are two attributes must appear productKey and parentCategoryKey, these are two string (xs: string) type of attribute values, respectively, said key elements of its own and the parents of the key category.


<xs:complexType name="category">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="category" type="category" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="product" type="product" minOccurs="0" maxOccurs="unbounded"/>
</ xs: sequence>
<xs:attribute name="categoryKey" type="xs:string" use="required"/>
<xs:attribute name="parentCategoryKey" type="xs:string" use="required"/>
</ xs: complexType>




This is the category description of element types, any type of document to use product can contain sub-elements elements are name, description, category and product. name and description of the types of elements are simple type xs: string. The category is a recursive element, the element refers to the type of their own. The elements of the type of product is a good product in front of the type described. Any type of document elements of product there are two attributes must appear categoryKey and parentCategoryKey, these are two string (xs: string) type of attribute values, respectively, said key elements of its own and the parents of the key category.


<xs:element name="save_category">
<xs:complexType>
<xs:sequence>
<xs:element name="authInfo" type="xs:base64Binary"/>
<xs:element name="category" type="category" minOccurs="0" maxOccurs="unbounded"/>
</ xs: sequence>
</ xs: complexType>
</ xs: element>




This is the Schema document in only one element of the definition of save_category is a composite element type, its elements can be authInfo and category. AuthInfo which is a base64 encoded string, which is a category can appear 0 to an unlimited number of category types for the sub-elements. We can easily find the type of definition and the definition of elements of the basic mechanism is the same as a matter of fact, this definition can be split into two paragraphs, one for the type definition, a definition for the elements, the following examples are given the equivalent, I hope contribute to the understanding of the Schema.


<xs:complexType name="save_category">
<xs:sequence>
<xs:element name="authInfo" type="xs:base64Binary"/>
<xs:element name="category" type="category" minOccurs="0" maxOccurs="unbounded"/>
</ xs: sequence>
</ xs: complexType>

<xs:element name="save_category" type="save_category" />




Why, then, to adopt the first method does not use the second method, the reasons are very simple, because the entire Web service-related information in the Schema, such as category, product, featureBag, compliantSpecBag, parameterBag these elements may be reused and therefore more appropriate to the type defined, and is a single save_category news, can not be reused by other elements, it has become the definition of the elements directly.


</ xs: schema>





.Net WebService Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.