Detailed description of the XML structure in the WSDL type and Information section
The data type of the WSDL is the "xml schema:datatypes" (XSD), according to the current recommendation of the consortium. There are three different versions of this file (1999, 2000/10, and 2001), and if you want to specify which version to use for a particular WSDL document, declare it as a namespace in the <definitions> element. The method is as follows:
Xmlns:xsd= "Http://www.w3.org/2001/XMLSchema"
This article is only based on the 2001 version of the consideration. The WSDL Standard Protector also strongly advocates the use of version 2001.
In this episode and subsequent chapters, the following is the first or named space speed notation:
The name space of the first word
SOAPENC http://schemas.xmlsoap.org/soap/encoding SOAP 1.1 encoded
WSDL Http://schemas.xmlsoap.org/wsdl/soap WSDL 1.1
XSD Http://www.w3.org/2001/XMLSchema XML Schema
XSD Basic Types
The following table is taken directly from the MSTK2 file, which lists all the XSD basic types supported by MSTK2. The table explains how the WSDL reader at the client and server level applies the XSD type to different and equal types in VB, C + +, and IDL.
Different types of XSD (SOAP) type VB C + + IDL annotations
AnyURI vt_bstr String BSTR BSTR
Base64binary Vt_array | Vt_ui1 Byte () SAFEARRAY SAFEARRAY (unsigned char)
Boolean Vt_bool boolean Variant_bool variant_bool
BYTE VT_I2 Integer short-short transformation time test range.
Date Vt_date Date date is Oo:oo:oo
DateTime vt_date Date Date
Double VT_R8 double Double
Duration VT_BSTR String BSTR BSTR No validation or conversion
Entities VT_BSTR String BSTR BSTR No validation or conversion
ENTITY vt_bstr String BSTR BSTR No validation or conversion
Float VT_R4 single float float
Gday vt_bstr String BSTR BSTR No validation or conversion
Gmonth vt_bstr String BSTR BSTR No validation or conversion
gMonthDay vt_bstr String BSTR BSTR No validation or conversion
Gyear vt_bstr String BSTR BSTR No validation or conversion
Gyearmonth vt_bstr String BSTR BSTR No validation or conversion
ID vt_bstr String BSTR BSTR No validation or conversion
IDREF vt_bstr String BSTR BSTR No validation or conversion
IDREFS vt_bstr String BSTR BSTR No validation or conversion
int VT_I4 Long Long
The integer vt_decimal Variant decimal decimal Transformation Experience range.
Language VT_BSTR String BSTR BSTR No validation or conversion
Long vt_decimal Variant Decimal decimal Transformation Experience range.
Name vt_bstr String BSTR BSTR No validation or conversion
NCName vt_bstr String BSTR BSTR No validation or conversion
The Negativeinteger vt_decimal Variant Decimal Decimal Transformation time range.
NmToken vt_bstr String BSTR BSTR No validation or conversion
Nmtokens vt_bstr String BSTR BSTR No validation or conversion
The nonNegativeInteger vt_decimal Variant Decimal Decimal Transformation time range.
The nonPositiveInteger vt_decimal Variant Decimal Decimal Transformation time range.
normalizedstring vt_bstr String BSTR BSTR
notation Vt_bstr String BSTR BSTR No validation or conversion
Number Vt_decimal Variant Decimal decimal
The positiveinteger vt_decimal Variant Decimal Decimal Transformation time range.
QName vt_bstr String BSTR BSTR No validation or conversion
Short VT_I2 Integer Short
String Vt_bstr string BSTR BSTR
Time Vt_date Date date is set to December 30, 1899
Token vt_bstr String BSTR BSTR No validation or conversion
Unsignedbyte vt_ui1 Byte unsigned char unsigned char
The Unsignedint vt_decimal Variant Decimal Decimal Transformation time range.
The Unsignedlong vt_decimal Variant Decimal Decimal Transformation time range.
Unsignedshort Vt_ui4 A long long long switch.
XSD defines the data types in both groups: basic types and derived types. For further information, you can go to the http://www.w3.org/TR/2001/PR-xmlschema-2-20010330 and view the hierarchical structure of the built type.
Complex types
XML schemas can be defined as complex types, i.e., struct in C. For example, the following C struct are defined in terms of:
But what,<complextype> can say is not just the struct. In addition to <sequence>, it can have other child elements. If <SEQUENCE> is not necessary, the <ALL> can be used:
The implication is that the member variables <element> can be entered in any order, and each of these options is optional. This is different from the way C struct is used.
Notice how the data types such as String (string), int (integer), float (float), and so on are used in the example. C's string is also a string in XML, and the floating-point number is a floating point number. But the long (length) of C, in XML, is int (please enter the table).
In the WSDL file, the Types section is where the complex type is declared. For example, the person type can be declared in the following manner and used in the Messages section:
In the example above, the first message is named "addperson", which has a <part> of a type "person". In the Types section, the type person is declared to be complex type.
When you start MSTK2 soapclient, you can successfully parse the file by using the full WSDL file in the fragment above. However, it is still not possible to send the function to <addPerson>. This is because soapclient itself does not know how to handle complex types; it needs a custom type of sensor (mapper) to handle complex types. There is a sample application in the MSTK2 file that contains a custom type of sensor.
There is also a method that can be used to connect <part> elements to type declarations. This method uses elements rather than types. The next example would be to declare two elements ("person" and "gender") in the Types area, and then in the <message> of "addperson", use the element attributes to refer to them.
In the Gender <element> of the Types section, an anonymous column type is embedded, and the value can be "male" or "female". Then, in the <message> of "addperson", the element is used (without type) to participate in it.
What is the difference between the use of "element" and "type" if you want to relate specific types to <PART>? If "type" is used, part can be described as being able to take a number of types (as in the case of a variable), but it cannot be done by using "elemental" attributes. Please refer to the following examples.
This example also illustrates the derivative use of the file name. Both "femaleperson" and "maleperson" are derived from "person". They all have an extra element: "femaleperson" 's "favoritelipstick" and "maleperson" 's "favoriteshavinglotion". Using the <choice> construct, these two derived types can also be combined to synthesize a complex type of "maleorfemaleperson". Finally, in the <message> of "addperson", this type of "person" is also available for <part> participation. And this <part> or the parameters can be "femaleperson" or "maleperson".
Array
XSD can provide <list> construct to declare a blank delimited array of entries. However, SOAP does not use XSD "soap-enc:array" to encode the array, but to define its own type, that is, the matrix. The following example shows how the whole array of single dimensions leads to this type in its own way:
You can declare a new complex type from Soapenc:array as long as you use a limited way. Then we can declare this complex type of arraytype: The "soapenc:arraytype" is actually a declaration of arraytype, in the following way:
The WSDL requirement is that the type name of the array must be the "arrayof" (concatenation) of the array item type. As a result, "arrayofperson" is an array of person struct. In the following example, if you use Arrayofperson to declare a <message>, you can add more person:
<portType> <operation> Elements
PortType can define many kinds of professions in the abstract. The PortType element in the code, which defines the language that calls all PortType methods. Each operating element declares the name of the method, the parameters (using the <message> element), the type (the <part> element declared in each <message>).
In a WSDL file, you can have more than one <portType> element. Each <portType> element, a group of ways of doing business, is very similar to the way the COM interface group is structured.
In a <operation> element, you can have a maximum of one <input> element, one <output> element, and one <fault> element. Each of these three elements has a name and information.
What is the purpose of using name in <input>, <output>, and <fault> elements? The original is for the two industries with the same name (multiple downloads). For example, the following two C functions, which have the same name, but different parameters.
void foo (int arg);
void foo (string arg);
When using WSDL, this is a much-downloaded expression:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.