wcf-rest

Transaction in REST WCF service

We are having a REST WCF service. we want the save operation on this REST service to be in transaction. Is there a way to pass Transaction object over the wire to REST WCF service? ...

Error when trying to create json web service in asp.net

I followed this to create a json web service in asp.net 3.5: http://www.pluralsight.com/community/blogs/fritz/archive/2008/01/31/50121.aspx It works fine if I want to use it internal but as I want to connect to it external I got an error saying: "Metadata publishing for this service is currently disabled." So I tried enabling it but...

How do I get a DataMemberAttribute use a boolean type

I have a simple test app that pulls an xml doc from a rest interface. The data element has a couple of string fields and a couple of boolean fields. I creates a simple entity class and put a DataContractAttribute on it and then added DataMemberAttributes to each data member. I then use HttpResponseMessage.Content.ReadAsDataContract() to ...

Access HttpContext inside WCF RequestInterceptor

I am using the WCF REST stater kit to build a plain xml over HTTP service. As part of this Im using a RequestInterceptor to do authentication. Inside of the RequestInterceptor I have access to a System.ServiceModel.Channels.RequestContext object from which i can get the request url, querystring params and other helpful things. What I can...

WCF: Is there a way to return different datetime serialization based on the http Accept-Language header?

I would like my REST service to return a DateTime as: 01-dec-2009 for Accept-Language: en-US 01-dez-2009 for Accept-Language: pt-BR Thanks! André Carlucci ...

How to consume RESTful webservices with WCF ?

Hi, Is that better to use WCF REST Starter Kit for consuming web services (REST) with WCF (by using HTTPClient) or do it directly with WCF ? It seems that WCF REST Starter kit won't be available for .NET 4.0 and is a preview version only. Thanks ! ...

How to enforce one method in WCF Rest to be called via https, while others can be called over http

Is there a way in a WCF Rest Service implementation to require one method be called over https, while allowing others to be called over http or https without having to define two service endpoint bindings? I want to be able to do something in my service implementation such as: if (CalledOverHttps()) { //Do Stuff } else { throw ne...

ProcessRequest from RequestInterceptor never ends [WCF]

So, I'm using the Developer's Guide to the WCF REST Starter Kit and having a problem with the RequestInterceptor. I have the exact code the guide is showing but for some reason the method never ends. This is my code: public override void ProcessRequest(ref RequestContext requestContext) { GenerateErrorResponse(requestContext, HttpSt...

Pass a JSON array to a WCF web service

I am trying to pass a JSON array to a WCF service. But it doesn't seem to work. I actually pulled an array [GetStudents] out the service and sent the exact same array back to the service [SaveStudents] and nothing (empty array) was received. The JSON array is of the format: [ {"Name":"John","Age":12}, {"Name":"Jane","Age":11}, {"N...

WcfRestContrib: Is there any example of using a WCF REST service (with basic authentication) from a desktop client

Is there any example of using a WCF REST service with basic HTTP authentication from a desktop client? I am using WCF REST Contrib. and authentication works fine when a use a javascript client from the browser, but when I try to use a C# Console app. I get a BasicUnauthorizedException {"You have unsuccessfully attempted to access a secu...

How to create a RESTful web service in asp.net?

Hi Guys, I simply want to create a fairly basic REST service, so that I can expose some of the data in my asp.net/SQL server application to the outside works, like this..... http://domain.com/api/offices - would return an xml set of office locations. http://domain.com/api/offices/15 - would return all the details of office 15. It's al...

Create a WCF REST Client Proxy Programatically (in C#)

I am trying to create a REST Client proxy programatically in C# using the code below but I keep getting a CommunicationException error. Am I missing something? public static class WebProxyFactory { public static T Create<T>(string url) where T : class { ServicePointManager.Expect100Continue = false; WebHttpBindin...

How can I change the xml:base published by a WCF Data Service?

Hi, I have a WCF Data Service for which I have a custom URL Rewriter so the real url is not visible and I can add special elements in the path for customizing it. For example: http://localhost/Data/ABCD.odata/ Maps to: http://localhost/Data/OneData.svc/ This almost works except that the service is publishing back in the response XML ...

Reading HttpRequest Body in REST WCF

Hi All, I got a REST WCF Service running in .net 4 and I've tested the web service it is working and accepting HttpRequest I make to it. But I ran into a problem trying to access the HttpRequest body within the web service. I've tried sending random sizes of data appended on the HttpRequest using both Fiddler and my WinForm app and I ca...

How to read binary data/image from WCF REST

I have the following: Public Interface INorthwindSvc <OperationContract()> <WebGet(UriTemplate:="EmployeePictureBytes?id={EmpId}")> Function GetEmployeePictureBytesById(ByVal EmpId As String) As Byte() End Interface I got the method implemented (using EF 4.0) as follows: Public Function GetEmployeePictureBytesById(ByVal EmpId As S...

When does ServiceHost get created and expire.

I have code as following: Public Class xxxSvcHostFactory Inherits ServiceHostFactory Protected Overrides Function CreateServiceHost(ByVal serviceType As Type, ByVal baseAddresses As Uri()) As ServiceHost Dim result As New WebServiceHost2(serviceType, True, baseAddresses) Return result End Function End Class...

Use StructureMap with WCF 4.0 REST Services

How do I use StructureMap in a WCF 4.0 REST service? I've used StructureMap in the past using this article but the technique doesn't seem to work with the WebServiceHostFactory(). What's the secret? ...

Adding REST methods to WCF Data Services?

Hi there, I need to extend my WCF Data Service to include additional methods, not only the database tables.. But it doesn't seem to be working correctly. Firstly i want to ask if this is legal? or throwned upon? The reason i need to do it is i need add additional REST methods that will make a call to ASP.NET Membership services (th...

Test Client for testing WCF Rest services or just use browser?

I have written my first rest services and currently i am testing them in a browser. Is there a test client or some sort that provides additional features or is this the normal way of testing i.e. in IE, Firefox etc? ...

HttpClient & HttpResponseMessage missing in VS 2010 - its for consume REST services

Hi there, does anyone know if HttpClient & HttpResponseMessage classes are available in VS 2010? I can't seem to get them to work, do i need to add a reference or using namespace? These classes were originally from the starter kit for REST for Vs 2008... In vs 2010 its built in i.e. no use for the starter kit... But how do I cosume t...