Sai
Sai

Reputation: 703

WCF Web HTTP Service Help Page

I have created a simple Northwind's Product REST Web Service in WCF at /Northwind/Product. I have also enabled WCF Web HTTP Service Help Page on my service, which is at /Northwind/Product/help. I have a "GET" operation and its help page is located at: /Northwind/Product/help/operations/Get, which is your standard WCF help page that displays the Xml body, Json body, Xml Schema and Additional Xml Schemas. Pretty straight forward, right? Okay now, on to the fun stuff...

I am interested in the Xml Schema section, which is:

<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>

I am interested in it because of the datatypes. I want to know the datatypes of the elements. Now, I understand that's not the fundamentals of REST. However, I don't want SOAP objects here. I want to keep my services simple and loosely typed and yet still be aware of their datatypes when needed.

My question is, how can I expose just this particular section of the help file? If I cannot do that, what are my other options for achieving what I am trying to do here?

Upvotes: 1

Views: 1331

Answers (2)

Pablo Castilla
Pablo Castilla

Reputation: 2741

Maybe you could try with OData, as I see it it is in between of REST and SOAP.

http://msdn.microsoft.com/es-es/library/cc668794.aspx

Upvotes: 1

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65391

I do not think that it is possible to be both loosly typed and a the same time know the types behind the fields.

You could send everything as a string, and then throw an exception if conversion is not possible.

There does not appear to be a tag in the xs:element tag that could be used for help infomation, http://www.w3schools.com/schema/el_element.asp

Upvotes: 1

Related Questions