I have declared a method called Authentication, this method takes an AuthenticationRequest as input. So this is where my problem starts. I have set the username and password variables on the AuthenicationRequest to private, so I am using an overloaded constructor to set them and getters to return them. On my client I am trying to call Authentication(new AuthenticationRequest("","")
) however the overloaded constructor isn't recognized. I am using C# WCF services. I am using visual studio to generate the client code from a web address.
Below I will post copies of my classes. I don't know a whole lot about WCF but from what I understand there are [Attributes] you need on certain things.
AuthenticationRequest
using Classes.General;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Web;
namespace Classes.Authentication
{
[DataContract]
public class AuthenicationRequest : Status
{
[DataMember]
private String Email, Password;
public AuthenicationRequest(String Email, String Password)
{
this.Email = Email;
this.Password = Password;
}
public void doWork()
{
}
public String GetEmail()
{
return this.Email;
}
public String GetPassword()
{
return this.Password;
}
}
}
Authentication.svc.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using MySql.Data.MySqlClient;
using Classes.General;
using Classes.Users;
using Classes.Authentication;
namespace WebApi_Nepp_Studios.Endpoints
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Authentication" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Authentication.svc or Authenication.svc.cs at the Solution Explorer and start debugging.
[ServiceContract]
public class Authentication
{
//Declare the MySQL variable for global databse operations
MySqlConnection conn = new MySqlConnection(Properties.Resources.Cs);
MySqlCommand cmd;
MySqlDataReader reader;
[OperationContract]
public AuthenicationResponse Authenicate(AuthenicationRequest input)
{
//Blah blah blah
}
}
}