How can I send xml data via post with help of WCF ?
for example I have some code:
public interface IServiceForILobby
{
[OperationContract]
[WebInvoke(Method = "POST")]
string SendXml(string response);
}
//This is HOST
static void Main(string[] args)
{
Console.WriteLine("*Console Based Rest HOST*");
using (WebServiceHost serviceHost = new WebServiceHost(typeof(ServiceForILobby)))
{
serviceHost.Open();
Console.ReadLine();
}
/*This is Client */
using (ChannelFactory<IServiceForILobby> cf = new ChannelFactory<IServiceForILobby>(new WebHttpBinding(), "http://192.168.1.103:50000/RestService/SendXml?response={x}"))
{
cf.Endpoint.EndpointBehaviors.Add(new WebHttpBehavior());
IServiceForILobby channel = cf.CreateChannel();
string s;
// s = channel.SendXml("http://192.168.1.103:50000/RestService/SendXml?response={x}");
string a;
using (StreamReader sr = new StreamReader("simplexml.txt"))
{
string xmlCode = sr.ReadToEnd();
s = channel.SendXml(xmlCode);
}
I want to send XML from the Client to the Host, and after to parse it like this How does one parse XML files?