-
Notifications
You must be signed in to change notification settings - Fork 37
How to use REST message based Client
Sergey Morenko edited this page May 10, 2014
·
4 revisions
Note - Nelibur's based on WCF and you certainly have all the power of the WCF
JsonServiceClient
requires the same paramas as HttpClient
For example:
var serviceAddress = "http://localhost:9092/webhost"
var client = new JsonServiceClient(serviceAddress);
var serviceAddress = "http://localhost:9092/webhost"
var client = new JsonServiceClient(serviceAddress);
var createRequest = new CreateClientRequest
{
Email = "email@email.com"
};
ClientResponse response = client.Post<ClientResponse>(createRequest);
var updateRequest = new UpdateClientRequest
{
Email = "new@email.com",
Id = response.Id
};
response = client.Put<ClientResponse>(updateRequest);
var getClientRequest = new GetClientRequest
{
Id = response.Id
};
response = client.Get<ClientResponse>(getClientRequest);
var deleteRequest = new DeleteClientRequest
{
Id = response.Id
};
client.Delete(deleteRequest);
Note: SoapServiceClient've appropriate Async operations: DeleteAsync, GetAsync, PostAsync, PutAsync