Complex UriTemplate for WCF

416 views Asked by At

I am totally new to WCF and web services.

I need to create a REST based wcf service for which I have got the sample walkthrough from code project.

I would like have the Uri Template like https://example.com/{v}/{resource}?filter={attribute}{op}{value}&sortBy={attributeName}&sortOrder={ascending|descending}&attributes={attribute list in csv}

attribute:attribute to be searched op:operator( format of eq,and,or,neq,like,contains ) value:attribute value to be searched attributeName:sortBy attribute name sortOrder should be enum with ascending or descending. attributes:attributeslist in csv

Is this possible?

Could anyone help me in configuring UriTemplate and OperationContract for this?

1

There are 1 answers

0
Seymour On

WCF allows for complex UriTemplate syntax.

Your UriTemplate, however, seems to violate some of the syntax rules.

The following MSDN page provides a comprehensive overview of the URITemplate syntax, compound path segments, wildcards and variable values, which should help you with your complex uriTemplate. The article also provides a good list of valid and invalid URI samples that should help you work out a syntax that will work for your service.

http://msdn.microsoft.com/en-us/library/bb675245(v=vs.110).aspx

Regards,