我已經在WCF中創建了一個簡單的Northwind產品REST Web服務/Northwind/Product
。我還在我的服務上啓用了WCF Web HTTP服務幫助頁面,該頁面位於/Northwind/Product/help
。我有一個「GET」操作,其幫助頁面位於:/Northwind/Product/help/operations/Get
,這是您的標準WCF幫助頁面,顯示Xml正文,Json正文,Xml架構和其他Xml架構。非常直截了當,對吧?現在沒事了,就到了有趣的東西...WCF Web HTTP服務幫助頁面
我有興趣在XML Schema部分,那就是:
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Product">
<xs:sequence>
<xs:element minOccurs="0" name="CategoryID" nillable="true" type="xs:int" />
<xs:element minOccurs="0" name="Discontinued" type="xs:boolean" />
<xs:element minOccurs="0" name="ProductID" type="xs:int" />
<xs:element minOccurs="0" name="ProductName" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="QuantityPerUnit" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="ReorderLevel" nillable="true" type="xs:short" />
<xs:element minOccurs="0" name="SupplierID" nillable="true" type="xs:int" />
<xs:element minOccurs="0" name="UnitPrice" nillable="true" type="xs:decimal" />
<xs:element minOccurs="0" name="UnitsInStock" nillable="true" type="xs:short" />
<xs:element minOccurs="0" name="UnitsOnOrder" nillable="true" type="xs:short" />
</xs:sequence>
</xs:complexType>
<xs:element name="Product" nillable="true" type="Product" />
</xs:schema>
我是因爲數據類型感興趣。我想知道元素的數據類型。現在,我明白這不是REST的基礎。但是,我不希望SOAP對象在這裏。我想保持我的服務簡單而鬆散的類型,但仍然需要時瞭解它們的數據類型。
我的問題是,如何才能公開幫助文件的這一特定部分?如果我不能這樣做,我還有什麼其他選擇可以實現我在這裏要做的事情?