Sending 0 to many attributes to SOAP service

0
Hi experts,  I’m trying to integrate an SAP-ERP SOAP service into my mendix application.  I created an export mapping based on the web service operation.  I need the option to send 0…many attributes of an entity to the service. (For example Document type and Document part but not the username (see export mapping) )  With my latest question, I found out, that Mendix can’t/won’t export empty entities. So, for example, the SAP web services don’t require all attributes of the entity  DocDraw2 to be filled out they are optional. But mendix won't let me send a request to service before I filled out all attributes of the entity. It is no problem to call the service without an entity of DocDraw2. It is also no problem to send a request with all attributes filled out. So that means I have to fill out all attributes(of DocDraw2) or none. I set the option Error when empty to “no” (see screenshot) but this didn’t help. Has this anything to do with the occurrence parameter in the export mapping? You can see the request structure inside the SOAP UI which causes no trouble with the web service. It would be helpful if I could send such a template (like SOAP UI) from mendix to the service.  Could a custom request template solve this issue? Or can I change the nillable parameter when I create the export mapping? right now it’s not possible to set this parameter to true.                
asked
3 answers
2

From the screenshots of the mappings I gather that the occurrences for all attributes are set to 1. This means that the attribute/field needs to be present. Setting the nillable option would allow the field to be nill, but does require it to be present. From the last screenshot you can see that the Documentdata is optional as the occurrence is 0..1, maybe a change in the definition that is read in is needed to make the attributes optional as well.

Now the webservice allows you to optionally provide a documentdata part, but if you provide this all fields are required.

answered
1

Looks like Mendix is complying to the webservice's definition and SOAPui is not. You are in luck that the webservice is accepting your SOAPcall allthough it is missing some attributes. Like Erwin said: if you want the attributes to be optional, the webservice that you have imported, should have it defined like that.

answered
0

 Ok thank you for your answers. So just to make sure the definition of the occurrence of an element can’t be changed manually in mendix because it is provided by the service definition (XSD file)? 

In my case and many other SAP SOAP services, it is no problem to provide empty elements like based on the service definition. 

For example, I have a service definition which has an optional element <Item> (see code below)  in this item element I only provide the <Documentnumer>. It is no problem for the SAP System to work with this message. But mendix wants to make sure, that I fill out all attributes of the optional <item> element. This behavior makes totally sense mendix ensures based on the export mapping that the data input is correct. 

My next Question is: Can I somehow send empty elements like <Documenttype></Documenttype> from mendix to my service. My problem would be solved if I could send such a request to my service. 

Because if I have a user interface and just skip the input filed mendix pops up with the “elements can’t be nillable error” and if I provide some string like ‘ ’ SAP wont accept the request. 

 

<item>
               <Deletevalue></Deletevalue>
               <Documenttype></Documenttype>
               <Documentnumber>12345</Documentnumber>
               <Documentpart></Documentpart>
               <Documentversion></Documentversion>
               <Originaltype></Originaltype>
               <Language></Language>
               <Sourcedatacarrier></Sourcedatacarrier>
               <Storagecategory></Storagecategory>
               <Docfile></Docfile>
               <Format></Format>
               <Description></Description>
               <PhObjid></PhObjid>
</item>

 

answered