public void InvokeSevice(String id, String nif, String cod)
{
//Llamando al método CreateSOAPWebRequest
HttpWebRequest request = CreateSOAPWebRequest();
XmlDocument SOAPReqBody = new XmlDocument();
//Solicitud de cuerpo SOAP
SOAPReqBody.LoadXml(@"<?xml version=""1.0"" encoding=""utf-8""?>
<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:tcsa=""http://tcsa.es/"">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<tcsa:obtenerDatos>
<tcsa:IDPaciente>" + id + @"</tcsa:IDPaciente>
<tcsa:NIF_Acceso>" + nif + @"</tcsa:NIF_Acceso>
<tcsa:CodCentro>" + cod + @"</tcsa:CodCentro>
</tcsa:obtenerDatos>
</soapenv:Body>
</soapenv:Envelope>");
using (Stream stream = request.GetRequestStream())
{
SOAPReqBody.Save(stream);
}
//Obteniendo Resspuesta de request
using (WebResponse Serviceres = request.GetResponse())
{
using (StreamReader rd = new StreamReader(Serviceres.GetResponseStream()))
{
//leyendo stream
var ServiceResult = rd.ReadToEnd();
xmlrespuesta.Text = ServiceResult.ToString();
rd.Close();
}
}
}