Integration of SOAP Technology and B2B Application (3)

zhaozj2021-02-17  82

Integration of SOAP Technology and B2B Application (3)

SOAP system and data coding rules

This article was originally published by the IBM DeveloperWorks China website, its URL is http://www.ibm.com/developerworks/cn/

SOAP's type and data encoding is based on a simple type system. This simple type system is based on type systems in programming language, database, and semi-structured data. It is the public characteristics of type systems in programming language, database, and semi-structured data. A generalization. In this simple type system, a type is either a simple (quantified) type or a composite type, which consists of multiple parts, each of which is a type (including simple type or composite type). There will be a more detailed description of the type after this article. SOAP defines a sequencing rule for the order of type of objects. It operates two levels, first, give a pattern described by this type of system, constructing an XML syntax layer, which constructs an XML syntax layer, which provides a type system mode and A representation of a value consistent with the pattern, constructs a mode of an XML instance layer (that is, the description of the value).

The namespace identifier used in the elements and properties defined in SOAP is http://schemas.xmlsoap.org/soap/encoding/.

The data model and the use of the data model and coding style described in the SOAP specification are encouraged instead of essential, other data models and codes can also be used in combination with SOAP, but the complete namespace modification must be used when used. Uniquely identifies the coded style.

XML provides a high flexibility and has a well-scalable data coding. The SOAP specification only defines a very limited coding rule, and the user can extend the basic definition as needed. This article describes the definition of coding rules at a high level, and later articles describe the clear type of coding rules.

Definition of Terms

In order to describe the encoding, first introduce and define the terms required to use below:

1. "Value" value is a string, a metric (number, date, rose) name, or a combination of several simple values. All values ​​have a clear type.

2. "Simple Value" simple value is an unsatuable value, which does not contain any part of any can be named. Examples of simple values ​​can be specific strings, certificates or rose values.

3. "Compound Value" composite value is a gathering of a value relationship. Examples of composite values ​​can be specific purchase orders, inventory reports, street addresses, etc.

4. In a composite value, each associated value can be distinguished by a role name, or use a number of orders to distinguish, of course, can be used simultaneously. This is called "Accessor" access ID. Examples of composite values ​​include specific purchase orders, inventory reports, and more. An array is also a composite value. It can be seen as a composite value of an access identifier having a plurality of the same name.

5. "Array" array, is a composite value, and only the order is different between its member values.

6. The "STRUCT" structure is a composite value, and the distinction between its member values ​​is to rely on Accessor. At the same time, all the names of access identification should be different.

7. Simple Type "simple type is the type of simple value. Simple types of examples include those "string", "integer", rose classes, etc.

8. "Compound Type" composite type is the type of composite value. Examples of composite types include an abstract type of purchasing order, which has the same access identifier (Shipto, Totalcost, etc.), of course they have different values ​​(perhaps constraints may be constrained for some values).

9. In a composite type, an access identity is unique in this composite type. If it is unable to distinguish between an access identity in other composite types, the access identification name is the name of the composite type. In order to be a unique identifier, this name is local name. Whether the name is directly or indirectly based on a URI, if the access identifier does not have to add type name constraints, then the name is called global name. 10. The information given in the order of the value tables is that it is possible to determine that some values ​​can only be associated with a simple instance of access identity. For other possible situations, this assertion cannot be disconnected. A value is called "Single-Reference" single reference, if only one access identifier can be referenced. If you can be quoted by multiple references, whether in fact, there is a potential, that is, "multi-reference" more references. Note that there is a certain value in a mode is single to use and others are more references. Regarding the simple difference between single and multi-references, the attributes such as IDs in the specific application make it more references, and it is not single reference.

11. On the syntax, an element can be independent or embedded. A separate element appears as a top element in order. And others are embedded elements.

Sequence rule

Although the representation of the USI: Type property can make values, it can be described, that is, the structure containing the value contains the type of value, but the type of sequencing rule allows the value of the type (SCHEMA) is defined only. . These modes can be described using the specification defined in "XML Schema Part 1: Structures" and "XML Schema Part 2: DataTypes", of course, other mode definitions can be used to define. Note that although this, many modes define only the structure (STRUCT) and array (array) types, and the order rules are likely to try the composite type outside of the structure (STRAY) type.

The order rules are as follows:

1. All values ​​should be characterized by the contents of the XML element (Content). A multi-reference value must be represented as an independent element.

2. The type of element that contains a value, the value of the value must meet at least one of the following conditions: (a) Element instance containing this value contains an XSI: Type property (for instant declaration type), (b) contains it Value element instances are included in an element with soap-enc: arraytyType properties (possibly default), (c) The name of this element has a type of explicit association, and this type is defined by a mode and decided.

3. A simple value should be expressed as character data, that is, it does not have any child elements. Each simple value must have a type, which is either in the DataTypes section of the XML Schema specification, or its meta type should be listed in this section.

4. A composite value should be encoded as an element sequence, where each access identifier is represented by an embedded element, and their name corresponds to one. If the name of the access identification is partially located in the type containing it, it has an unmodified element name, and the access identifier with the global name should have a fully modified name.

5. A simple or composite value of a multi-reference should be encoded as an independent element, which should contain a local "ID" attribute with non-limiting name, which is the type of ID defined in the XML specification. For all access identities for this same value, it should be an empty element, which has a local unmovable attribute "href", which is the "uri-reason" type defined in the XML Schema specification, " The value of the HREF "property is a URI clip identifier that references to the corresponding independent element.

6. String and byte arrays are represented as multi-reference simple types, but special rules also allow them to be more efficiently represented in general cases. A string or byte array access identifier can have an id type named "ID". If this is, all other access identities for the same value can be encoded as an empty element, which should include a local "href" attribute with a non-limiting name, which is the type of XML Schema specification. The value of the "URI-REFERENCE" type, the value of the "href" property is a URI clip identifier that references the corresponding independent element. 7. Multiple references to a value encoding are allowed, which seems to be a reference to multiple different values, but in fact these reference handles are referenced by the same value entity.

8. Array is a composite value. The SOAP array is defined as the type "SOAP-ENC: Array" or type is from "SOAP-ENC: Array".

The SOAP array has one or more dimension, and its members are distinguished by the order. The value of an array is represented as a sequence that can represent the elements of the array, which appears in a small order in order. For multi-dimensional arrays, the element dimension changes from right to left order. Each member element is named a separate element [see Code Rules 2].

The SOAP array can be a single value, or a multi-reference value, so that it can be represented as an embedded element or a separate element.

The SOAP array must contain a "soap-enc: arrayType" property, where the type of value defined contains the value of the element describes the array with the dimension. The value of the "SOAP-ENC: ARRAYTYPE" property is as follows:

ArrayTypeValue = atype asseatype = qname * (rank) rank = "[" * (",") "]" asize = "[" #olength "]" = 1 * Digit

The "Atype" structure is the name of the type of element included in arrays. First it contains a QNAME indicating that QNAME should appear in the "Type" attribute in the XML Schema element declaration, is a pre-defined type name, QNAME is a Type constraints (meaning that all elements they contained should be uniformly consistent with the specified type, that is, the type referenced in SOAP-ENC: ArrayType must be the type or element type of all array elements). For those arrays or "jagged arrays", using the RANK structure, the element of the array is an array, and the specific type of the array will be instantiated when the specific member array of the next layer is defined, and zero appears in Rank, one To multiple commas, the member variable is a one-dimensional, two-dimensional or multi-dimensional array. For multidimensional arrays, dimensions are defined as a "," separated dimension sequence, each dimension counting base is 1 (that is, the declaration is 6, there is 6 elements, but we will know The reference to each member is 0..5).

The "Asize" structure contains a length of each dimension of an array indicated by a comma-separated sequence consisting of zero, one or more integers. A sequence consisting of zero integer indicates that there is no particular limitation on the array, but the specific size will be determined (eg, ",", "," 6, 6, 6, 6 "" 2, "" 3, 3 by the specific size. ").

For example, an array of 5 members, each member's type is an array of Integer, but the length of each member can be determined, then its arrayTyPEVALUE should be "int [] [5]". Where the value of atype is "int []", the value of Asize is "[5]". Similarly, a group with three members, member types are INTEGER 2D arrays, and its value of ARRAYTYPEVALUE should be "int [,] [3]". Among them, the value of atype is "int [,]", and the value of asize is "[3]". SOAP array members can include a "soap-enc: offset" attribute to indicate the offset in the array of the member. This can also be used to indicate the offset of members in the array described in one portion. Similarly, the SOAP array member can include a "soap-enc: position" property to indicate the location of the member in its load. This can also be used to indicate the location of the members in a sparsely described array. The value of "SOAP-ENC: Offset" and "SOAP-ENC: Position" attribute is defined as:

ArrayPoint = "[" #olength "]"

Their cardinals are 0.

9. NULL values ​​and default values ​​can be omitted in access identification elements (depending on the definitions in the mode schema, or). NULL value can be specified in an attribute XSI: null using a value of 1 in an access identification element, or may be other dependent attributes and values.

Note Rules 2 allows a member element in the independent element and an array to freely use the element name, without having to correspond to the name of the type thereof.

转载请注明原文地址:https://www.9cbs.com/read-29003.html

New Post(0)