简体   繁体   中英

Complex UriTemplate for WCF

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?

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,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM