結構描述支援
WsUtil.exe 支援 XML 架構中指定的 XSD 架構。 xsd 檔案和 wsdl:type 應該在相同的類別中處理,但當全域元素可以是參數列表時,wsdl:type 中的例外狀況。 Wsutil.exe 會針對可用於串行化程式的所有全域專案定義產生元素描述,以及 WSDL 支援中所指定參數結構的其他輸出。
XSD 架構支援層級
WsUtil.exe 不支援 XSD 架構的完整範圍。 目前的支援層級定義於 架構支援層級中。
標識碼產生
架構中的專案名稱或類型名稱可能不是有效的 C 識別元,而且名稱會正規化為產生的有效 C 名稱。 無效的 C 識別符字元會轉換成十六進位名稱,而且如有必要,底線 『_』 可能會加上名稱。 匿名類型是以封入專案名稱命名,但前面加上底線 “_” 以避免名稱衝突。 全域類型名稱會保留,因為它在正規化無效的字元之後。 巢狀匿名類型前面會加上父類型名稱。
對於每個全域元素定義,wsutil.exe 會在 全域描述結構中產生WS_ELEMENT_DESCRIPTION 。 對於每個全域類型定義,wsutil.exe 會在要由應用程式參考的全域描述結構中產生類型描述。
針對 結構中的每個欄位,wsutil.exe 會產生內嵌WS_FIELD_DESCRIPTION作為機箱結構的一部分。
簡單類型
實值型別,如WS_VALUE_TYPE所列,會被視為簡單型別。 請注意,WS_VALUE_TYPE實際上是WS_TYPE的子集。 其中包含基本的整數和 float 數據類型,以及 DECIMAL、WS_DATETIME 和 UUID。
在服務模型中,在簡單型別中會以值傳遞,而 out 和 in,則會以傳址方式傳遞簡單型別。
Wsutil 會針對包含簡單型別的全域專案建立簡單專案描述,如下所示。
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="helloworld" type="xs:int"></xs:element>
</xs:schema>
Wsutil 會產生下列專案描述:
... // global elements
{ // helloworld
{
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.helloworldTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.helloworldTypeNamespace,
WS_INT32_TYPE,
0,
},
}, // helloworld
...
此結構會當做標頭檔中產生的全域描述結構的一部分產生:
typedef struct _example_wsdl
{
WS_ELEMENT_DESCRIPTION helloworld;
} _example_wsdl;
陣列
maxOccurs 大於 1 的專案,或只有一個專案的序列,而子元素的 maxOccurs 大於 1,則會被視為數位。 若為架構中的陣列元素,wsutil.exe 會產生兩個字段:一個未連線的計數位段,以及一個包含數位型別的指標字段。
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="SimpleArray">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="50" name="a" nillable="true" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
頭檔包含陣列的 C 結構定義,欄位 aCount 指定數位的計數。
typedef struct SimpleArray
{
unsigned int aCount ;
int * a;
} SimpleArray;
以下是描述陣列的 LocalDefinition 原型的一部分:
... // globalElement part of the LocalDefinitions.
struct // SimpleArray
{
struct // SimpleArray
{
WS_FIELD_DESCRIPTION a;
WS_FIELD_DESCRIPTION * SimpleArrayFields [1];
WS_STRUCT_DESCRIPTION structDesc;
} SimpleArraydescs; // SimpleArray
WS_ELEMENT_DESCRIPTION elementDesc;
} SimpleArray;
// Method with array parameters.
typedef HRESULT (CALLBACK *SimpleMethodCallback)(
const WS_OPERATION_CONTEXT* context,
unsigned int aCount,
int* a,
unsigned int *bCount,
int** b,
unsigned int* cCount,
int** c,
const WS_ASYNC_CONTEXT* asyncContext,
WS_ERROR* error);
HRESULT CALLBACK SimpleMethod (
WS_SERVICE_PROXY* serviceProxy,
WS_HEAP* heap,
unsigned int aCount,
int* a,
unsigned int *bCount,
int** b,
unsigned int* cCount,
int** c,
const WS_ASYNC_CONTEXT* asyncContext,
WS_ERROR* error);
以下是上述描述所產生的定義,請注意WS_REPEATING_ELEMENT_FIELD_MAPPING,以數位列欄位表示欄位。
...
{ // SimpleArray
{ // SimpleArray
{ // field description for a
WS_REPEATING_ELEMENT_FIELD_MAPPING,
0,
0,
WS_INT32_TYPE,
0,
WsOffsetOf(SimpleArray, a),
0,
0,
WsOffsetOf(SimpleArray, aCount),
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aLocalName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aNamespace,
}, // end of field description for a
{ // fields description for SimpleArray
(WS_FIELD_DESCRIPTION*)&example_wsdlLocalDefinitions.globalElements.SimpleArray.SimpleArraydescs.a,
},
{
sizeof(SimpleArray),
__alignof(SimpleArray),
(WS_FIELD_DESCRIPTION**)example_wsdlLocalDefinitions.globalElements.SimpleArray.SimpleArraydescs.
SimpleArrayFields,
WsCountOf(example_wsdlLocalDefinitions.globalElements.SimpleArray.SimpleArraydescs.SimpleArrayFields),
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aNamespace,
}, // struct description for SimpleArray
}, // SimpleArray
{
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aNamespace,
WS_STRUCT_TYPE,
(void *)&example_wsdlLocalDefinitions.globalElements.SimpleArray.SimpleArraydescs.structDesc,
},
}, // SimpleArray
...
如果陣列是輸入/輸出訊息中的參數位段,則會為方法產生兩個實際參數。 如果陣列是 out 或 in,out 參數,則 paramStruct 中這兩個字段會有一個額外的間接層級。
數位上的範圍
我們建議不要為陣列指定 maxOccur=“unbounded” 的最佳做法。 相反地,應該指定固定整數,以設定允許的陣列計數上限。 整數型別以及字串、位元組陣列和泛型數位都支援 range。
包裝的啟發學習法,而不是未包裝的陣列
有時候陣列會包裝在另一個結構內,以內嵌在最上層結構中。 在此情況下,我們應該移除中繼包裝函式層。 WsUtil.exe 會產生與上述 SimpleArray 相同的原型和描述。
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="SimpleArray">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="50" name="aa" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:element name="SimpleArrayWrapper">
<xs:complexType>
<xs:sequence>
<xs:element name="SimpleArray" type="tns:SimpleArray" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Wsutil 會偵測 SimpleArrayWrapper 是 SimpleArray 的包裝函式,而且只會產生下列結構,並針對 SimpleArray 使用不同的結構
typedef struct SimpleArrayWrapper
{
unsigned int SimpleArrayCount ;
int * SimpleArray;
} SimpleArrayWrapper;
.. // global element inside the LocalDefinitions prototype
struct // SimpleArrayWrapper
{
struct // SimpleArrayWrapper
{
WS_FIELD_DESCRIPTION SimpleArray;
WS_FIELD_DESCRIPTION * SimpleArrayWrapperFields [1];
WS_STRUCT_DESCRIPTION structDesc;
} SimpleArrayWrapperdescs; // SimpleArrayWrapper
WS_ELEMENT_DESCRIPTION elementDesc;
} SimpleArrayWrapper;
...
wsutil.exe 會針對上述相符的原型產生下列定義,請注意,在欄位描述中,包裝函式名稱和包裝函式命名空間欄位已填入
... // global element part of the LocalDefinitions structure:
{ // SimpleArrayWrapper
{ // SimpleArrayWrapper
{ // WS_FIELD_DESCRIPTION for SimpleArray
WS_REPEATING_ELEMENT_FIELD_MAPPING,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayWrapperName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayNamespace,
WS_INT32_TYPE,
0,
WsOffsetOf(SimpleArrayWrapper, SimpleArray),
0,
0,
WsOffsetOf(SimpleArrayWrapper, SimpleArrayCount),
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayLocalName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayNamespace,
}, // end of field description for SimpleArray
{ // array of field descriptions for SimpleArrayWrapper
(WS_FIELD_DESCRIPTION *)&example_wsdlLocalDefinitions.globalElements.SimpleArrayWrapper.SimpleArrayWrapperdescs.SimpleArray,
},
{ // WS_STRUCT_DESCRIPTION for SimpleArrayWrapper
sizeof(SimpleArrayWrapper),
__alignof(SimpleArrayWrapper),
(WS_FIELD_DESCRIPTION**)example_wsdlLocalDefinitions.globalElements.SimpleArrayWrapper.SimpleArrayWrapperdescs.SimpleArrayWrapperFields,
WsCountOf(example_wsdlLocalDefinitions.globalElements.SimpleArrayWrapper.SimpleArrayWrapperdescs.SimpleArrayWrapperFields),
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayWrapperTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayNamespace,
}, // struct description for SimpleArrayWrapper
}, // SimpleArrayWrapper
{ // WS_ELEMENT_DESCRIPTION for SimpleArrayWrapper
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayWrapperTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.SimpleArrayNamespace,
WS_STRUCT_TYPE,
(void *)&example_wsdlLocalDefinitions.globalElements.SimpleArrayWrapper.SimpleArrayWrapperdescs.structDesc,
},
}, // SimpleArrayWrapper
結構
序列中具有多個元素的 complexType 是結構。 例如,
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="StructType">
<xs:sequence>
<xs:element minOccurs="0" name="FirstName" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="LastName" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="StructType" nillable="true" type="tns:StructType" />
</xs:schema>
Wsutil.exe 會產生結構原型,如下所示:
struct StructType
{
WS_STRING FirstName;
WS_STRING LastName;
};
// methods using structure parameters.
typedef HRESULT (CALLBACK *SimpleMethodCallback) (
const WS_OPERATION_CONTEXT* context,
StructType* a,
StructType** b,
StructType** c,
const WS_ASYNC_CONTEXT* asyncContext,
WS_ERROR* error);
HRESULT CALLBACK SimpleMethod (WS_SERVICE_PROXY* serviceProxy,
WS_HEAP* heap,
StructType* a,
StructType** b,
StructType** c,
const WS_ASYNC_CONTEXT* asyncContext,
WS_ERROR* error);
wsutil 會產生下列 LocalDefinition 原型:
struct // StructType
{
struct // StructType
{
WS_FIELD_DESCRIPTION FirstName;
WS_FIELD_DESCRIPTION LastName;
WS_FIELD_DESCRIPTION * StructTypeFields [2];
WS_STRUCT_DESCRIPTION structDesc;
} StructTypedescs; // StructType
WS_ELEMENT_DESCRIPTION elementDesc;
}
結構的定義如下所示,結構中有兩個字段描述。
// global element inside LocalDefinitions.
{ // StructType
{ // StructType
{ // field description for FirstName
WS_ELEMENT_FIELD_MAPPING,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.FirstNameLocalName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.FirstNameNamespace,
WS_STRING_TYPE,
0,
WsOffsetOf(StructType, FirstName),
0,
0,
}, // end of field description for FirstName
{ // field description for LastName
WS_ELEMENT_FIELD_MAPPING,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.LastNameLocalName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.FirstNameNamespace,
WS_STRING_TYPE,
0,
WsOffsetOf(StructType, LastName),
0,
0,
}, // end of field description for LastName
{ // fields description for StructType
(WS_FIELD_DESCRIPTION *)&example_wsdlLocalDefinitions.globalElements.StructType.StructTypedescs.FirstName,
(WS_FIELD_DESCRIPTION *)&example_wsdlLocalDefinitions.globalElements.StructType.StructTypedescs.LastName,
},
{ // WS_STRUCT_DESCRIPTION for StructType
sizeof(StructType),
__alignof(StructType),
(WS_FIELD_DESCRIPTION**)example_wsdlLocalDefinitions.globalElements.StructType.StructTypedescs.StructTypeFields,
WsCountOf(example_wsdlLocalDefinitions.globalElements.StructType.StructTypedescs.StructTypeFields),
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.StructTypeTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.FirstNameNamespace,
}, // struct description for StructType
}, // StructType
{
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.StructTypeTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.FirstNameNamespace,
WS_STRUCT_TYPE,
(void *)&example_wsdlLocalDefinitions.globalElements.StructType.StructTypedescs.structDesc,
},
}, // StructType
為了支援擴充性,一律會以傳址方式定義內嵌結構。 在服務中,所有 out 或 in、out 結構都會透過雙指標傳遞,以允許結構的未來延伸,以及允許 nillable 結構。
遞歸結構
支援遞歸結構,而內嵌型別會以傳址方式傳遞。 針對下列 wsdl:
<xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="SimpleMethod">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="a" type="xs:int" />
<xs:element minOccurs="0" name="b" type="tns:example" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="example">
<xs:sequence>
<xs:element minOccurs="0" name="d" type="tns:example" />
<xs:element minOccurs="0" name="c" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:schema>
Wsutil 會產生下列類型定義,以及類型描述:
typedef struct example
{
struct example * d;
int32 c;
} example;
typedef struct SimpleMethod
{
unsigned __int32 a;
struct example * b;
} SimpleMethod;
// global element part of the LocalDefinitions.
...
struct // SimpleMethod
{
struct // SimpleMethod
{
WS_FIELD_DESCRIPTION a;
struct // example
{
WS_FIELD_DESCRIPTION d;
WS_FIELD_DESCRIPTION c;
WS_FIELD_DESCRIPTION * exampleFields [2];
WS_STRUCT_DESCRIPTION structDesc;
} exampledescs; // example
WS_FIELD_DESCRIPTION b;
WS_FIELD_DESCRIPTION * SimpleMethodFields [2];
WS_STRUCT_DESCRIPTION structDesc;
} SimpleMethoddescs; // SimpleMethod
WS_ELEMENT_DESCRIPTION elementDesc;
} SimpleMethod;
...
定義會產生如下:
{ // SimpleMethod
{ // field description for a
WS_ELEMENT_FIELD_MAPPING,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aLocalName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aNamespace,
WS_INT32_TYPE,
0,
WsOffsetOf(SimpleMethod, a),
0,
0,
}, // end of field description for a
{ // example
{ // field description for d
WS_ELEMENT_FIELD_MAPPING,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.dLocalName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aNamespace,
WS_STRUCT_TYPE,
(WS_STRUCT_DESCRIPTION*)&example_wsdlLocalDefinitions.globalElements.SimpleMethod.SimpleMethoddescs.structDesc,
WsOffsetOf(example, d),
WS_FIELD_POINTER,
0,
}, // end of field description for d
{ // field description for c
WS_ELEMENT_FIELD_MAPPING,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.cLocalName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aNamespace,
WS_INT32_TYPE,
0,
WsOffsetOf(example, c),
0,
0,
}, // end of field description for c
{ // fields description for example
(WS_FIELD_DESCRIPTION *)&example_wsdlLocalDefinitions.globalElements.SimpleMethod.SimpleMethoddescs.exampledescs.d,
(WS_FIELD_DESCRIPTION *)&example_wsdlLocalDefinitions.globalElements.SimpleMethod.SimpleMethoddescs.exampledescs.c,
},
{
sizeof(example),
__alignof(example),
(WS_FIELD_DESCRIPTION**)example_wsdlLocalDefinitions.globalElements.SimpleMethod.SimpleMethoddescs.exampledescs.exampleFields,
WsCountOf(example_wsdlLocalDefinitions.globalElements.SimpleMethod.SimpleMethoddescs.exampledescs.exampleFields),
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.exampleTypeName,
(WS_XML_STRING*)&example_wsdlLocalDefinitions.dictionary.xmlStrings.aNamespace,
}, // struct description for example
}
結構繼承
wsutil 支援複雜類型延伸模組,其中一個複雜類型是另一個複雜類型的延伸模組。
<s:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
targetNamespace="http://Example.org" xmlns:s="http://www.w3.org/2001/XMLSchema">
<s:complexType name="LinkList">
<s:sequence>
<s:element minOccurs="0" name="d" type="tns:LinkList" />
<s:element minOccurs="0" name="c" type="s:int" />
</s:sequence>
</s:complexType>
<s:element name="DerivedLinkList">
<s:complexType>
<s:complexContent>
<s:extension base="tns:LinkList">
<s:sequence>
<s:element name="derive1" type="s:int" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
</s:element>
</s:schema>
上述 xsd 片段表示 DerivedLinkList 衍生自 LinkList。
Wsutil.exe 會產生 C 和 C++ 的協助程式例程,讓應用程式更容易設定基底類型和衍生型別的類型資訊。 在下列程式代碼中,_WS_CPLUSPLUS宏可用來區分 C 和 C++ 語言的定義:
#if defined(_WS_CPLUSPLUS)
typedef struct LinkList
{
LinkList();
LinkList(WS_STRUCT_DESCRIPTION*);
struct _DerivedLinkList* WINAPI As_DerivedLinkList();
const struct _WS_STRUCT_DESCRIPTION* _type;
struct LinkList * d;
int c;
} LinkList;
#endif
#if !defined(_WS_CPLUSPLUS)
typedef struct LinkList
{
const struct _WS_STRUCT_DESCRIPTION* _type;
struct LinkList * d;
int c;
} LinkList;
void WINAPI LinkList_Init(LinkList*);
#endif
#if defined(_WS_CPLUSPLUS)
typedef struct _DerivedLinkList:LinkList
{
_DerivedLinkList();
int derive1;
} _DerivedLinkList;
#endif
#if !defined(_WS_CPLUSPLUS)
typedef struct _DerivedLinkList
{
struct LinkList _base;
int derive1;
} _DerivedLinkList;
struct _DerivedLinkList* WINAPI LinkList_As_DerivedLinkList(LinkList*);
#endif
在 C 樣式協助程式中,在串行化之前,應用程式會呼叫 wsutil 產生的例程LinkList_Init初始化結構,並將類型描述設定為 LinkList 類型描述。 還原串行化之後,應用程式可以呼叫 LinkList_As_DerivedLinkList 以取得衍生類型。
若要在運行時間中擷取類型資訊,wsutil 會產生具有 WS_STRUCT_DESCRIPTION* 類型的第一個字段,並 WS_TYPE_ATTRIBUTE_FIELD_MAPPING 欄位對應來描述 xsi:type 資訊。 應用程式可以直接設定或檢查欄位,以判斷結構的實際類型。 例如,下列程式代碼會將 結構的類型設定為DrivedLinkList:
_DerivedLinkList derivedLinkList;
derivedLinkList._base._type = (WS_STRUCT_DESCRIPTION*)test_xsd.globalElements.DerivedLinkList.typeDescription;
WsWriteType(
writer,
WS_ELEMENT_TYPE_MAPPING,
WS_STRUCT_TYPE,
(WS_STRUCT_DESCRIPTION*)test_xsd.globalElements.DerivedLinkList.typeDescription,
...);
還原串行化 結構之後,應用程式可以直接比較類型描述,以判斷還原串行化類型:
if (derviedLinkList._base._type == (WS_STRUCT_DESCRIPTION*)test_xsd.globalElements.DerivedLinkList.typeDescription)
{
// the deserialized type is of type _DerivedLinkList
...
}
wsutil 產生基底結構和衍生結構的類別。 默認建構函式會初始化型別和比對型別描述。 AsDerivedType 例程有助於在類型之間執行安全型別轉換。
{ // field description for typeOfLinkList
WS_TYPE_ATTRIBUTE_FIELD_MAPPING,
0,
0,
WS_DESCRIPTION_TYPE,
0,
WsOffsetOf(LinkList, typeOfLinkList),
0,
0,
}, // end of field description for typeOfLinkList ...
{
sizeof(LinkList),
__alignof(LinkList),
(WS_FIELD_DESCRIPTION**)&test_xsdLocalDefinitions.globalTypes.LinkListdescs.LinkListFields,
WsCountOf(test_xsdLocalDefinitions.globalTypes.LinkListdescs.LinkListFields),
(WS_XML_STRING*)&test_xsdLocalDefinitions.dictionary.xmlStrings.LinkListTypeName,
(WS_XML_STRING*)&test_xsdLocalDefinitions.dictionary.xmlStrings.LinkListTypeNamespace,
0,
(WS_STRUCT_DESCRIPTION**)&test_xsdLocalDefinitions.globalTypes.LinkListdescs.SubTypes,
1,
}, // struct description for LinkList
nillable
字串、結構及位元組數位支援nillable屬性。 WS_FIELD_NILLABLE屬性將會新增至具有nillable屬性的欄位。 如果元素為 nillable,指標將會設定為 NULL 。 結構中可擷取的欄位會被視為指標。 具有nillable屬性的參數結構將會以傳址方式傳遞。
指標
實值型別必須以傳值或傳址方式傳遞 out 參數。 除了只輸出結構之外,不允許雙指標。
無參數
請記得先前討論訊息部分的「參數」名稱。 如果指定這個值,我們會嘗試為產生的服務作業產生輸入和輸出訊息的合併框架。 如果未指定,則產生的服務作業會以參數的形式包含輸入和輸出訊息。
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://Sapphire.org"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" targetNamespace="http://Sapphire.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:message name="ISimpleService_SimpleMethod_InputMessage">
<wsdl:part name="noparameters" element="tns:SimpleMethod" />
</wsdl:message>
<wsdl:message name="ISimpleService_SimpleMethod_OutputMessage">
<wsdl:part name="noparameters" element="tns:SimpleMethodResponse" />
</wsdl:message>
</wsdl:definitions>
因此,針對我們的SimpleMethod作業,服務和用戶端的簽章看起來會像這樣。
typedef HRESULT (CALLBACK *SimpleMethodCallback)
(const WS_OPERATION_CONTEXT* context,
SimpleMethodRequest* inMessage,
SimpleMethodResponse** outMessage,
const WS_ASYNC_CONTEXT* asyncContext,
WS_ERROR* error);
HRESULT CALLBACK SimpleMethod (
WS_SERVICE_PROXY* serviceProxy,
WS_HEAP* heap,
SimpleMethodRequest* inMessage,
SimpleMethodResponse** outMessage,
const WS_ASYNC_CONTEXT* asyncContext,
WS_ERROR* error);
安全性
請參閱 Wsutil 編譯程式工具和串行化的安全性一節