Is it even possible to do a JSON call in WCF (.NET 3.0)? - wcf

Looking over the web, I am finding no answer to this question. I see it being asked and a lot of people being referred to .Net 3.5; however, I am not seeing anything resembling an answer with in the restricted environment of WCF 3.0 (VS2005).
Is it possible for me to do an AJAX/JSON call to a WCF 3.0 Web Service or is the only option to use ASMX if you aren't able to use .Net 3.5?

Microsoft's ASP.NET 2.0 AJAX Extensions 1.0 contains classes to serialize and deserialize JSON for .NET 2.0 and newer.
The class that does it is System.Web.Script.Serialization.JavaScriptSerializer.
Note that even though the documentation linked above is for the 3.5 version, the 3.5 version is identical to the 2.0 version, because it was deprecated and replaced in 3.5 by the classes in System.Runtime.Serialization.Json.
I'm not really sure how to use this with WCF, though... the only time I used it was as an ashx handler.

There are no out of the box bindings in .NET 3.0 that will allow you to send JSON responses. You will need to implement it yourself. There's an article showing how to do REST with POX. It could be easily adapted to JSON but as you will see there's not negligible amount of work.

Related

Examples of how to a STS in .Net 4.5 using WCF

I'm looking for Examples of how to a STS in .Net 4.5 using WCF.
So the scenario is I have a MVC 4 web app that I want to write an STS to authenticate and get claims that stores its data in the traditional SqlMembershipProvider database schema that we all know and love.
I'm guessing the STS could be a simple WCF service.
I've googled around but can only find stuff that shows how to do all this when the WIF was separated from the Core Framework. I.e. before it was embedded in .Net 4.5
Writing your solution may not be as easy as you expect it to be. Have a look at https://github.com/thinktecture/Thinktecture.IdentityServer.v2 which is a .NET STS. I guess using it will suffice in your case and it is very actively developed.

Calling .NET 3.5+ ASMX web service or WCF service from .NET 2.0 CF

I'm working on project for old PDAs that run on the .NET 2.0 CF (compact framework). Right now we are using .NET 2.0 ASMX web services, but I find that severely limiting. It is missing all sorts of things like extension methods, funcs, actions, LINQ, generic data-structures like HashSet(of T), etc., that would be useful for getting stuff done.
Eventually we're probably going to get rid of the PDAs and replace them with some other technology. For that reason I'd like to, as best as I can, write a re-usable/RESTful-ish backend (thus WCF).
I've looked online, but haven't had much luck finding information. At the very least I'm hoping to upgrade the backend to .NET 3.5 for improved functionality. Is it possible?
if you just want the new framework libraries and c# syntax than your asmx services would work just fine on 3.5, no need to migrate to wcf.
if you want rest you should take a look at asp.net web api though it is .net 4 only.

WCF & DataContract consumed by .net 2 client

I have developed a WCF service (framework 4.0) which should communicate with a client through BasicHttpBinding.
I have kept my (data)contracts in a separate assembly cause I want them to be reused by multiple clients.
Everything works as expected if I reference my WCF Service as a service (Service References) in a .net 4 client and set "Reuse types in referenced assemblies".
The problem is I have to consume the same WCF service with a .net 2 client.
In this situation the generated proxy is different from my shared assembly datacontract and I don't seem to be able to reuse it or cast it to the generated proxy.
Is there a way to solve this issue?
Thanks for your help.
Well, .NET 2.0 has no WCF API at all because it wasn't added until 3.0. So forget sharing the library because there's nothing to really share it with. The .NET 2.0 application will have to use the older WSE (Web Service Extensions) API. Documentation on WSE is available here on MSDN and you can download the last version of the WSE API that was made, 3.0 SP3, here.
You should have no problem getting WSE to talk to WCF via a basicHttpBinding. Things would only get complicated if you started using WS-* stuff and, even then, WSE supports a lot of that. It's just hard to find help on it since it's a deprecated API.

How to Use the WCF Service developed in .Net 4.0 in the Application developed in 2.0 or lower version?

I came across with this situation. I have one already developed Application in 2.0, Now in this application i want to use one WCF Service that is developed in 4.0. How can i do this?
I tried the following
1. Regular Method Add the Service Reference and then use that. It didn't work for me.
2. I googled it and i got one more method, using svcutil.exe, but i dont have svcutil.exe with 2.0.
Waiting for the response.
Thanks in advance.
Windows Communication Foundation (WCF) was first introduced to the .NET Framework as part of .NET 3.0. It's not available with .NET 2.0.
If the WCF service exposes a SOAP endpoint then you may be able to use it through the Web Service Extensions (WSE) that were published for old versions of Visual Studio. See here: http://www.microsoft.com/download/en/details.aspx?id=10854 for details.
If you want to use a service written in .Net 4 with a .Net 2.0 project, you should be able to use basic http binding. That should allow it to interop with a client that knows nothing about WCF. It's similar to using an old school .asmx web service.

WCF Interceptor On Compact Framework

I would like to add an interceptor layer to my WCF service to send the Device ID to authenticate the device.
I am very very new to WCF Interceptors. Before I take all the time to figure them out, I would like to know if they even work with the Compact Framework.
So, do WCF Interceptors work with the Compact Framework and if so are there any special considerations I need to keep in mind as I research them. (Any C# examples of how to do this would be AWESOME!)
I am using Visual Studio 2008 SP1.
I haven't used WCF myself, but a quick glance at this article shows me you need the IChannelFactory and/or IChannelListener classes which are supported on .NET CF 3.5.
The article also has a downloadable sample app, which you probably can modify to run on .NET CF.
So I can't give you any considerations or gotchas, but it looks to me you won't be on a dead end road here.
Interceptors cannot be created on WCF for Compact Framework (NETCF). The IClientMessageInspector and similar constructs needed for interceptors are not present in NETCF.
You can add custom soap headers though. You just have to add them to each WCF Service Call.