i am new and need some help. i have created an wcf service application in visual studio and write an simple method of login which receive an parameter userid & password then return an object of logged user object which have two fields name and organization.
LoggedUser Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
namespace crmpp_android_service
{
public class LoggedUser
{
public string name;
public string organization;
[DataMember]
public string Name
{
get { return name; }
set { name = value; }
}
[DataMember]
public string Organization
{
get { return organization; }
set { organization = value; }
}
}
}
OperationContract:
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "login/?userid={userid} & pass={pass}"
)]
[Description("User Login return username & Organization currently affiliated")]
LoggedUser login(string userid, string pass);
Method Implementation in Service1.svc:
public LoggedUser login(string userid , string pass)
{
LoggedUser log_usr = new LoggedUser();
log_usr.name = "Ahsan Mehdi";
log_usr.organization = "JDC";
return log_usr;
}
but when i run application by pressing ctrl+F5 it open an wcf test Client like this and return data.
I am unable to get response from android app or simply from browser when i write URL for service it shows me page like that.
http://localhost:57127/Service1.svc
and when complete url like this
http://localhost:57127/Service1.svc/login/?userid=abc123&pass123
it returns nothing any guidelike or help please as soon as possible.