using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml;
using System.Net;
using System.IO;
namespace WindowsFormService
{
public class HttpSend
{
public XDocument sendXmlAndGetResponse(XDocument xDocument)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xDocument.Document.ToString());
WebResponse resp;
string strUrl = XMLTools.getXmlValue("LFListenerAddress", "Address");// "http://localhost:8008/hello/";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strUrl);
myRequest.ContentType = "text/xml";
myRequest.Method = "POST";
Stream stm = myRequest.GetRequestStream();
doc.Save(stm);
stm.Close();
resp = myRequest.GetResponse();
stm = resp.GetResponseStream();
//StreamReader r = new StreamReader(stm);
//MessageBox.Show(r.ReadToEnd().ToString(), "MESSAGE ");
var reDoc = new XmlDocument();
reDoc.Load(stm);
return reDoc.ToXDocument();
}
}
}