Your question is not clear, but here is some code which could help you starting...
If this is your rest service:
[DataContract]
[Serializable]
public class SendData
{
[DataMember(Order=1)]
public string cmd;
[DataMember(Order=2)]
public string data;
}
namespace My_Server
{
[ServiceContract]
public interface IRestService
{
[WebInvoke(Method = "POST",
UriTemplate = "logon",
RequestFormat = WebMessageFormat.Xml,
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare)]
[OperationContract]
LogonResult DoLogon(SendData data);
}
}
...then your client cmd could look like this:
private void DoLogon(string credentials)
{
SendData sd = new SendData();
sd.cmd = "EXTERNAL-USER";
sd.data = credentials;
XmlDocument xdoc = HttpPost("https://yourserver-ip:443/internal/logon", sd);
DataContractSerializer dcSer = new DataContractSerializer(typeof(LogonResult));
StringWriter stringWriter = new StringWriter();
XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter);
xdoc.WriteTo(xmlWriter);
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(stringWriter.ToString()));
stream.Position = 0;
XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(stream, new XmlDictionaryReaderQuotas());
LogonResult res = (LogonResult)dcSer.ReadObject(reader, true);
do something with the result...
}
The class library to share between server and client:
namespace DataLib
{
[Serializable]
public class LogonResult
{
public bool bCmdSuccess;
public string sInfo;
}
}