Consuming published webservice - object works, list does not work
I published an entity within mendix as an object through a webservice, using the 'first object only' property within the underlying microflow. So in effect the webservice publishes a single record. in order to test the webservice I want to consume it in my Mendix App, simply by deploying an imported webservice and supplying a xml-to-domain mapping. Within the xml-to-domain mapping I only use and map 3 out of 5 available elements. When consuming this webservice in Mendix - as an imported webservice - everything works out well, I can eventually consume it multiple times as a single object. Everytime I copy a new object is inserted with 3 attributes with values. When publishing the webservice as a list, I can consume it only "one time". Different from the single object copy, the list will also include the latest copied record with 3 attributes. My entity has no constraints yet, so there seems to be no reason why a copy action the second time should result in some kind of NULL failure. When looking in the error log I notice the following. The odd thing is, I don not use orderstatuscode in my xml-to-domain mapping, I didn't select it as an element therefore do not understand this message Caused by: com.mendix.modules.webservices.WebserviceException: Received SOAP fault, code: Server, reason: Attribute 'order_status_code' is not optional but mapped value 'Orders.Customer_Orders.Orders.Customer_Orders.order_status_code' is null
The error message seems to indicate that the published web service itself caused the error and not the web service call or mapping. The message says "Received SOAP fault, code: Server", which means that an error occurred on the server side (the published web service) and not on the client side (web service call).
Apparently you published a web service that returns an entity containing an attribute 'order_status_code' and you didn't mark the attribute as optional in the published web service's return type editor. This will cause an error if the value of that attribute is null for an object you are returning from the microflow of the published web service, because it is required in the output of the published web service.