Accept WCF request in WebAPI

I need to enable my webAPI REST service to accept a request in the format of:

www.someURL.com/OldService.svc

I am working on an existing application that used to use WCF. These methods do not have to return anything but a 200 response. We need the REST service to handle this call so we can retire the old WCF service, but systems will fail if we don't support this WCF request.

Has anybody done this before?

edit:

Is it possible to do this with just adding a new route?

Upvotes: 0

Views: 329

Answers (2)

Bruno
Bruno

Reputation: 563

Maybe you could use the Route attribute(using System.Web.Http) for the old service? I've used this for route names like [Route("SomeRoute")] but I'm not 100% sure if the .svc extension will interfere with anything.

[Route("OldService.svc")]
    [HttpPost]        
    public HttpResponseMessage NewData(Data SomeData)
    {}

Upvotes: 0

Kinexus
Kinexus

Reputation: 12904

You can add a WCF service (.svc) to a Web API project by simply adding a New Item and selecting Web, it will then show up in the list as WCF Service.

Upvotes: 1

Related Questions