string requestString = @"<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Test xmlns="urn:microsoft-dynamics-schemas/codeunit/test"></Test></soap:Body></soap:Envelope>"; System.Net.HttpWebRequest request; System.Net.HttpWebResponse response = null; string url = "http://dev.vava.dk:7047/DynamicsNAV70/WS/CRONUS%20Danmark%20A%2FS/Codeunit/test"; byte[] requestBuffer = null; System.IO.Stream postStream = null; System.IO.Stream responseStream = null; System.IO.StreamReader responseReader = null; request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url); request.ProtocolVersion = new Version(1, 1); request.Method = "POST"; request.Headers.Add("SOAPAction", @"urn:microsoft-dynamics-schemas/codeunit/test:HelloWorld"); request.ContentType = @"application/xml; charset=utf-8"; requestBuffer = System.Text.Encoding.ASCII.GetBytes(requestString); request.ContentLength = requestBuffer.Length; request.Credentials = new System.Net.NetworkCredential("thusan", "Cey_121212"); postStream = request.GetRequestStream(); postStream.Write(requestBuffer, 0, requestBuffer.Length); postStream.Close(); response = (System.Net.HttpWebResponse)request.GetResponse(); responseStream = response.GetResponseStream(); string response_result = string.Empty; if (responseStream != null) { responseReader = new System.IO.StreamReader(responseStream); response_result = responseReader.ReadToEnd(); } Label1.Text = response_result;
Comments
http://mibuso.com/blogs/ara3n/2009/11/1 ... b-service/
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n