记录一下备查。
数据定义在这个单元:unit Soap.InvokeRegistry;
比如:
TByteSOAPArray = array of Byte;TIntegerSOAPArray = array of Integer;TCardinalSOAPArray = array of Cardinal;TWordSOAPArray = array of Word;TSmallIntSOAPArray = array of SmallInt;TShortIntSOAPArray = array of ShortInt;TInt64SOAPArray = array of Int64;TLongWordSOAPArray = array of LongWord;TSingleSOAPArray = array of Single;TDoubleSOAPArray = array of Double;TBooleanSOAPArray = array of Boolean;TStringSOAPArray = array of string;
这些数据类型定义不是简单的定义一下,而是要注册到系统里面,注册代码也在这个单元里面。
注册代码片段:
{$IFNDEF NEXTGEN}RemClassRegistry.RegisterXSInfo(TypeInfo(System.ShortString), XMLSchemaNameSpace, 'string');RemClassRegistry.RegisterXSInfo(TypeInfo(System.AnsiChar), XMLSchemaNameSpace, 'string');RemClassRegistry.RegisterXSInfo(TypeInfo(System.WideChar), XMLSchemaNameSpace, 'string');
{$ENDIF !NEXTGEN}RemClassRegistry.RegisterXSInfo(TypeInfo(System.Char), XMLSchemaNameSpace, 'string');RemClassRegistry.RegisterXSInfo(TypeInfo(TByteSOAPArray), XMLSchemaNameSpace, 'base64Binary');RemClassRegistry.RegisterXSInfo(TypeInfo(System.Types.TByteDynArray), XMLSchemaNameSpace, 'base64Binary');{ Whether we register 'anyType' or 'anySimpleType first determines how we expose Variants -we'll opt for anyType as it seems to be the most interoperable although anySimpleTypeis the better semantic match }RemClassRegistry.RegisterXSInfo(TypeInfo(System.Variant), XMLSchemaNameSpace, 'anyType');RemClassRegistry.RegisterXSInfo(TypeInfo(System.Variant), XMLSchemaNameSpace, 'anySimpleType');RemClassRegistry.RegisterXSInfo(TypeInfo(System.Variant), XMLSchemaNameSpace, 'ur-type');RemClassRegistry.RegisterXSInfo(TypeInfo(System.OleVariant), XMLSchemaNameSpace, 'anyType');
理论上,在 SOAP WebService 的接口里面使用的数据类型,必须是注册过的。
当然,简单类型,比如 Integer 可以直接使用。