0

I must use .NET 3.5 for my project and I'm trying to create a client for a ServiceStack .NET 4.0 server. I am Win 7, VS 2010, .NET 3.5. After searching around the web for hours I found an older version of ServiceStack here: https://github.com/ServiceStackV3/ServiceStackV3

You can install it like:

PM> Install-Package ServiceStack -Version 3.9.71

This succeeded, but then I found out there is no client methods that I can find for this call:

var client = new JsonServiceClient("http://host:8080/");

So then I tried to install the client:

PM> Install-Package ServiceStack.Client -Version 3.9.71

and it could not find this package. How do I create a .NET 3.5 client? I've tried many things including finding a known prior version of the Client, but I don't know enough about Github to find one.

Scott
  • 21,211
  • 8
  • 65
  • 72
tradetree
  • 354
  • 3
  • 20
  • *I'm trying to create a client for a ServiceStack* I had a look at ServiceStack and it looks like it makes RESTful APIs. So (it would seem to me) a client could be any client -- it doesn't need to be ServiceStack based. – ta.speot.is Feb 25 '14 at 03:37
  • Correct, but not a strongly typed client. I have used "HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);" before for raw requests that I then parse, like: "string[] subcode = regex.Split(substrings[2]);" where the "substrings" are from the raw response. But I'm trying to be cleaner than all this and use types. Perhaps there is a cleaner method than mine that is built-in to C# or a library? – tradetree Feb 25 '14 at 03:43
  • One solution would be a generic C# JSON parser: using System.Runtime.Serialization.Json; A full example here: http://msdn.microsoft.com/en-us/library/hh674188.aspx But I was hoping to use the servicestack client library. – tradetree Feb 25 '14 at 04:03
  • HttpClient is sort-of strongly typed http://www.asp.net/web-api/overview/web-api-clients/calling-a-web-api-from-a-net-client – ta.speot.is Feb 25 '14 at 04:20

1 Answers1

1

As noted in the v3 documentation for the c# client, you will find the client in the ServiceStack.Common NuGet package. So it can be installed using:

Install-Package ServiceStack.Common

The client exists under the namespace ServiceStack.ServiceClient.Web.

Scott
  • 21,211
  • 8
  • 65
  • 72
  • I must be missing something because I had installed ServiceStack.Common, that was not the issue. What I did not realize was that instead of "using ServiceStack.Common" I needed to be "using ServiceStack.ServiceClient.Web". But I still do not see this in the documentation. There is this line, "e.g. by running Install-Package ServiceStack.Common in the package manager console." But nothing about ServiceClient.Web. – tradetree Feb 25 '14 at 14:10
  • 2
    @tradetree Yeah the documentation doesn't give hints to the namespace, which can be a pain. Tools like resharper for Visual Studio help, because they can auto discover the namespace for you. Xamarin Studio also has this functionality built in too. If you don't want to use a tool to help find the appropriate namespace you can search of the class name in the source code on GitHub, then you will find the namespace. I will suggest that the documentation is updated to make it clearer. – Scott Feb 25 '14 at 14:20