I am new to Webservices so any help world be great.
I have created a WCF project, C# 4.0. I have my OperationContract and my DataContract setup like below. I also have a edmx.cs page that contant the SP. In my service page(also below) I am trying to retun the data but get an erro that the conversion fails.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace EPCS_WebService
{
[ServiceContract]
public interface IEPCSService
{
[OperationContract]
GetProcessList GetList(int intLine);
}
[DataContract]
public class GetProcessList
{
[DataMember]
public int ProcessID { get; set; }
[DataMember]
public string Process { get; set; }
[DataMember]
public int Station { get; set; }
[DataMember]
public string StationDesc { get; set; }
[DataMember]
public Boolean BarCodePassThru { get; set; }
[DataMember]
public int NbrPassThruScanFld { get; set; }
[DataMember]
public string PassThruDestHost { get; set; }
[DataMember]
public int PassThruDestPort { get; set; }
[DataMember]
public int InactiveTimeout { get; set; }
[DataMember]
public int CommitVehicleTimeout { get; set; }
[DataMember]
public int VehicleListRefreshInterval { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace EPCS_WebService
{
public class EPCS_Service : IEPCSService
{
public GetProcessList GetList(int intLine)
{
T02_EPCSEntities efProcList = new T02_EPCSEntities();
var spQuery = efProcList.GetProcessList(intLine);
if (spQuery != null)
{
return TranslateProcessList(spQuery);
}
}
private GetProcessList TranslateProcessList(GetProcessList spQuery)
{
GetProcessList GetProcessList = new GetProcessList();
GetProcessList.ProcessID = spQuery.ProcessID;
GetProcessList.Process = spQuery.Process;
GetProcessList.Station = spQuery.Station;
GetProcessList.BarCodePassThru = spQuery.BarCodePassThru;
GetProcessList.NbrPassThruScanFld = spQuery.NbrPassThruScanFld;
GetProcessList.InactiveTimeout = spQuery.InactiveTimeout;
GetProcessList.CommitVehicleTimeout = spQuery.CommitVehicleTimeout;
GetProcessList.VehicleListRefreshInterval = spQuery.VehicleListRefreshInterval;
return GetProcessList;
}
}
}
I have created a WCF project, C# 4.0. I have my OperationContract and my DataContract setup like below. I also have a edmx.cs page that contant the SP. In my service page(also below) I am trying to retun the data but get an erro that the conversion fails.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace EPCS_WebService
{
[ServiceContract]
public interface IEPCSService
{
[OperationContract]
GetProcessList GetList(int intLine);
}
[DataContract]
public class GetProcessList
{
[DataMember]
public int ProcessID { get; set; }
[DataMember]
public string Process { get; set; }
[DataMember]
public int Station { get; set; }
[DataMember]
public string StationDesc { get; set; }
[DataMember]
public Boolean BarCodePassThru { get; set; }
[DataMember]
public int NbrPassThruScanFld { get; set; }
[DataMember]
public string PassThruDestHost { get; set; }
[DataMember]
public int PassThruDestPort { get; set; }
[DataMember]
public int InactiveTimeout { get; set; }
[DataMember]
public int CommitVehicleTimeout { get; set; }
[DataMember]
public int VehicleListRefreshInterval { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace EPCS_WebService
{
public class EPCS_Service : IEPCSService
{
public GetProcessList GetList(int intLine)
{
T02_EPCSEntities efProcList = new T02_EPCSEntities();
var spQuery = efProcList.GetProcessList(intLine);
if (spQuery != null)
{
return TranslateProcessList(spQuery);
}
}
private GetProcessList TranslateProcessList(GetProcessList spQuery)
{
GetProcessList GetProcessList = new GetProcessList();
GetProcessList.ProcessID = spQuery.ProcessID;
GetProcessList.Process = spQuery.Process;
GetProcessList.Station = spQuery.Station;
GetProcessList.BarCodePassThru = spQuery.BarCodePassThru;
GetProcessList.NbrPassThruScanFld = spQuery.NbrPassThruScanFld;
GetProcessList.InactiveTimeout = spQuery.InactiveTimeout;
GetProcessList.CommitVehicleTimeout = spQuery.CommitVehicleTimeout;
GetProcessList.VehicleListRefreshInterval = spQuery.VehicleListRefreshInterval;
return GetProcessList;
}
}
}