Mendix web service validation

1
I'm having problems getting Mendix to check mandatory fields in a web service. I've created a very simple web service, it contains three string fields that are marked in the published web service as non optional. When I check the WSDL I can see that minOccurs=1 for all three attributes. I would expect the web server to do something when one of these fields is empty, but no matter what I try, this doesn't happen. The web service is more than happy to except messages that have empty mandatory fields and fields that do not even exist. Also, when I expose a one to one relation in a web service, Mendix shows in the WSDL that minOccurs = 0 and maxOccurs = 1, when I sent a message with more repeats is not a problem at all, Mendix will only fill the relation of the last item in the repeating structure and orphans the rest. Am I missing something here? I would expect some form of validation?!
asked
2 answers
1

minOccurs=1 means that the element is present at all, this is different from an element that contains no value or is empty.

Furthermore you can add more fields that are not present because these are simply ignored by mendix. There are some things to say about this though. For one mendix adds the <sequence> tag, but in reality they do not care at all about the order in which tags are presented. The same goes for the repetition because the maxOccurs=1 is not upheld you can add as much repition to your xml message as you like, it will simply parse the last element and ignore the rest. I would suggest you file a feature request to solve this issue.

Some examples:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://www.example.com/">
   <soapenv:Header>
      <exam:authentication>
         <username>testws</username>
         <password>testws</password>
      </exam:authentication>
   </soapenv:Header>
   <soapenv:Body>
      <exam:Operation>
         <Three>Three</Three>
         <One>One</One>
         <Two/>
      </exam:Operation>
   </soapenv:Body>
</soapenv:Envelope>

Has a result of:

<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.example.com/">
   <soap:Body>
      <tns:OperationResponse>
         <Result>result</Result>
      </tns:OperationResponse>
   </soap:Body>
</soap:Envelope>

While the following will cause a validation error.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://www.example.com/">
   <soapenv:Header>
      <exam:authentication>
         <username>testws</username>
         <password>testws</password>
      </exam:authentication>
   </soapenv:Header>
   <soapenv:Body>
      <exam:Operation>
         <Three>Three</Three>
         <One>One</One>
      </exam:Operation>
   </soapenv:Body>
</soapenv:Envelope>

And the error:

<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>Client</faultcode>
         <faultstring>The parameter 'Two' is required but not set</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

And the following also works:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://www.example.com/">
   <soapenv:Header>
      <exam:authentication>
         <username>testws</username>
         <password>testws</password>
      </exam:authentication>
   </soapenv:Header>
   <soapenv:Body>
      <exam:Operation>
         <Three>Three</Three>
         <One>One</One>
         <Two>Two</Two>
    <Two>Two.Two</Two>
      </exam:Operation>
   </soapenv:Body>
</soapenv:Envelope>

Allthough my wsdl has no maxOccurs defined, according to the w3 this should be seen as 1 if not present. link

answered
0

Same here 4.3.2. Seems a bug to me. File a support ticket.

answered