I'm trying to pass the class object via Post Async Method
public async void SAveDetails(clsPickList obj)
{
using (HttpClient client = new HttpClient())
{
HttpContent content = new StringContent(JsonConvert.SerializeObject(obj));
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var result = await client.PostAsync("http://-Port-/-svc file name-/InsertUserDetails", content) ;
result.EnsureSuccessStatusCode();
if (result.Content != null)
{
var responseContent = await result.Content.ReadAsStringAsync();
}
}
}
to
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "InsertUserDetails")]
string InsertUserDetails(Model.clsPickList obj);
and Insert object value as follows
public string InsertUserDetails(Model.clsPickList obj)
{
cmd.Parameters.AddWithValue("@UserName", obj.UserName);
cmd.Parameters.AddWithValue("@Password", obj.Password);
}
but when I Access th Link via WP8 it returns 404 error. Since I'm new to WCF ,I really Appreciate anyones Help.
Thanks in advance..