Web Service描述语言 WSDL 详解(4)

WSDL的Types栏和Messages栏中的XML Schema

WSDL数据类型是基于"XML Schema: Datatypes"(XSD)的,现在已经被W3C推荐。这一文档共有三个版本(1999,2000/10,2001),因此必须在namespace属性的<definitions>元素中指明所使用的是哪一个版本。

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

在本文中,我将只考虑2001版本。WSDL标准的推荐者强烈建议使用2001版。

在本栏和以后各部分,需使用以下简缩或前缀

前缀代表的Namespace描述
Soapenchttp://schemas.xmlsoap.org/soap/encodingSOAP 1.1 encoding
Wsdlhttp://schemas.xmlsoap.org/wsdl/soapWSDL 1.1
Xsdhttp://www.w3.org/2001/XMLSchemaXML Schema

XSD基类型

下表是直接从MSTK2文档中取出的,列举了MSTK2所支持的所有XSD基类型。它也告诉在客户端或服务器端的WSDL读取程序如何把XSD类型映射到在VB、C++和IDL中相应的类型。

XSD (Soap)类型变量类型VBC++IDLComments
anyURIVT_BSTRStringBSTRBSTR
base64BinaryVT_ARRAYVT_UI1Byte()SAFEARRAYSAFEARRAY(unsigned char)
BooleanVT_BOOLBooleanVARIANT_BOOLVARIANT_BOOL
ByteVT_I2Integershortshort转换时验证范围有效性
DateVT_DATEDateDATEDATE时间设为 oo:oo:oo
DateTimeVT_DATEDateDATEDATE
DoubleVT_R8Doubledoubledouble
DurationVT_BSTRStringBSTRBSTR不转换和生效
ENTITIESVT_BSTRStringBSTRBSTR不转换和生效
ENTITYVT_BSTRStringBSTRBSTR不转换和生效
FloatVT_R4Singlefloatfloat
GDayVT_BSTRStringBSTRBSTR不转换和生效
GMonthVT_BSTRStringBSTRBSTR不转换和生效
GMonthDayVT_BSTRStringBSTRBSTR不转换和生效
GYearVT_BSTRStringBSTRBSTR不转换和生效
GYearMonthVT_BSTRStringBSTRBSTR不转换和生效
IDVT_BSTRStringBSTRBSTR不转换和生效
IDREFVT_BSTRStringBSTRBSTR不转换和生效
IDREFSVT_BSTRStringBSTRBSTR不转换和生效
IntVT_I4Longlonglong
IntegerVT_DECIMALVariantDECIMALDECIMAL转换时范围生效
LanguageVT_BSTRStringBSTRBSTR不转换和生效
LongVT_DECIMALVariantDECIMALDECIMAL转换时范围生效
NameVT_BSTRStringBSTRBSTR不转换和生效
NCNameVT_BSTRStringBSTRBSTR不转换和生效
negativeIntegerVT_DECIMALVariantDECIMALDECIMAL转换时范围生效
NMTOKENVT_BSTRStringBSTRBSTR不转换和生效
NMTOKENSVT_BSTRStringBSTRBSTR不转换和生效
nonNegativeIntegeVT_DECIMALVariantDECIMALDECIMAL转换时范围生效
nonPositiveIntegerVT_DECIMALVariantDECIMADECIMAL转换时范围生效
normalizedStringVT_BSTRStringBSTRBSTR
NOTATIONVT_BSTRStringBSTRBSTR不转换和生效
NumberVT_DECIMALVariantDECIMALDECIMAL
positiveIntegerVT_DECIMALVariantDECIMALDECIMAL转换时范围生效
QnameVT_BSTRStringBSTRBSTR不转换和生效
ShortVT_I2Integershortshort
StringVT_BSTRStringBSTRBSTR
TimeVT_DATEDateDATEDATE日设为1899年12月30日
TokenVT_BSTRStringBSTRBSTR不转换和生效
unsignedByteVT_UI1Byteunsigned charunsigned char
UnsignedIntVT_DECIMALVariantDECIMALDECIMAL转换时范围生效
unsignedLongVT_DECIMALVariantDECIMALDECIMAL转换时范围生效
unsignedShortVT_UI4LongLongLong转换时范围生效

XSD定义了两套内建的数据类型:原始的和派生的。在下文中查阅内建数据类型的层次十分有益:

http://www.w3.org/TR/2001/PR-xmlschema-2-20010330

Published At
Categories with Web编程
Tagged with
comments powered by Disqus