C# soap request to websevice

Hey, I have build a C# page where i can get data from my (Mendix) webservice. This should give the name to my Mendix app, and the mendix app uses this name to create an object. Then it should return the object in XMl, but intsead it returns the HTML of the page and it doesn't create an object. Does somebody know how to fix this? Here is my c# code:     public void Execute()         {             HttpWebRequest request = CreateWebRequest();             XmlDocument soapEnvelopeXml = new XmlDocument();             soapEnvelopeXml.LoadXml(@"<?xml version=""1.0"" encoding =""utf-8""?>     <soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:tns=""http://localhost:8080/ws-doc/"">     <soap:Body>     <tns:SoapRequest>     <Naam>Naam1234</Naam>     </tns:SoapRequest>     </soap:Body>     </soap:Envelope>");             using (Stream stream = request.GetRequestStream())             {                 soapEnvelopeXml.Save(stream);             }             using (WebResponse response = request.GetResponse())             {                 using (StreamReader rd = new StreamReader(response.GetResponseStream()))                 {                     string soapResult = rd.ReadToEnd();                     System.Diagnostics.Debug.WriteLine(soapResult);                 }             }         }         /// <summary>         /// Create a soap webrequest to [Url]         /// </summary>         /// <returns></returns>         public HttpWebRequest CreateWebRequest()         {             HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(@"http://localhost:8080/ws-doc/Published_web_service/SoapRequest");             webRequest.Headers.Add(@"SOAP:Action");             webRequest.ContentType = "text/xml;charset=\"utf-8\"";             webRequest.Accept = "text/xml";             webRequest.Method = "POST";             return webRequest;         }         protected void Button1_Click(object sender, EventArgs e)         {                Execute();                 }     } Here is my Mendix microflow: Here is my log node when I push the button on the C# page:
1 answers

Hi Atze,

I just got it working and see an envelope returned when debugging in C# as you can see below. Only difference is that I didn't include the webmethod in the webrequest url. Would that fix your issue? Else just let me know and I send you both test projects.

So use 

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(@"http://localhost:8080/ws/Published_web_service_test");

instead of

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(@"http://localhost:8080/ws-doc/Published_web_service/SoapRequest");