Hello, I'm currently building a page in C# which makes contact with my Mendix webservice. I have done this before, but now I constantly get an error and I don't know why. Is there somebody who could help me? My webservice documentation is here: https://mhchbs.mxapps.io/ws-doc/Published_web_service/VoorkeurCreate Here is my C# code: public void CreateNew() { int LidNr = (int)(Session["vrijwilliger"]); HttpWebRequest request = CreateWebRequest(); XmlDocument soapEnvelopeXml = new XmlDocument(); soapEnvelopeXml.LoadXml(String.Format(@"<?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:VoorkeurCreate> <Eerste>{0}</Eerste> <LidNr>{1}</LidNr> <Vijfde>{2}</Vijfde> <Tweede>{3}</Tweede> <Vierde>{4}</Vierde> <Derde>{5}</Derde> </tns:VoorkeurCreate> </soap:Body> </soap:Envelope>", DropDownList1.SelectedValue.ToString(), LidNr, DropDownList5.SelectedValue.ToString(), DropDownList2.SelectedValue.ToString(), DropDownList4.SelectedValue.ToString(), DropDownList3.SelectedValue.ToString())); using (Stream stream = request.GetRequestStream()) { soapEnvelopeXml.Save(stream); } using (WebResponse response = request.GetResponse()) { using (StreamReader rd = new StreamReader(response.GetResponseStream())) { string soapResult = rd.ReadToEnd(); } } } And this is the error I constantly get: com.mendix.integration.WebserviceException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'LidNr'. One of '{Derde}' is expected. PS. I am also wandering why Mendix changes the order of the parameters of the SOAP call
asked
atze de groot
2 answers
1
According to the WSDL, your XML should look like this:
And to answer your PS part: this depends on the changes you made in the mapping. If you change a current mapping and place extra fields in the mapping these new fields will always be added at the bottom in the XML. Otherwise it would break the webservice.