Мне нужна помощь, у меня есть следующий код,
Сервисы в порядке, протестируйте через SoapUi Image:
Изображение тестового мыла здесь
Ошибка:
Удаленный сервер возвратил ошибку: (400) Неверный запрос.
String xmlql = "@<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:con='contact.crm.amsa'><soapenv:Header/><soapenv:Body><con:CreateReclamo><con:request><con:Apellido>as</con:Apellido><con:Asunto>as</con:Asunto><con:Ciudad>asasas</con:Ciudad><con:Email>allanm@xms.cl</con:Email><con:Mensaje>as</con:Mensaje><con:Nombre>as</con:Nombre><con:Pais>as</con:Pais></con:request></con:CreateReclamo></soapenv:Body></soapenv:Envelope>";
byte[] data2 = encoding.GetBytes(xmlql);
String url = "https://amssclsrmprd02:511/WebServices/Contacto.svc";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
// Preparacion de Request con variables POST / TExt/XML - Credenciales
//HttpWebRequest myRequest =(HttpWebRequest)WebRequest.Create(new Uri("https://amssclsrmprd02:511/WebServices/Contacto.svc"));
myRequest.Method = "POST";
myRequest.ContentType = "text/xml; charset=utf-8";
myRequest.Headers.Add("SOAPAction", "CreateReclamo");
myRequest.ContentLength = data2.Length;
myRequest.Credentials = new NetworkCredential("crm","amsa");
Umbraco.Core.Logging.LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "******************** response ----");
//escribo en Webservicesa
using (Stream putStream = myRequest.GetRequestStream())
{
//putStream.Write(bytes, 0, bytes.Length);
putStream.Write(data2, 0, data2.Length);
using (HttpWebResponse response = (HttpWebResponse)myRequest.GetResponse())
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
Umbraco.Core.Logging.LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "******************** response " + reader.ReadToEnd() + " ----");
}
}