1. First of all
null in XML is represented as attribute:
<element xsi:nil="true"/>
- not as empty element.
This is different explicit value.
2. Web Services stack in BPM Standard is very, very limited.
However, when I was last time using WS-Services (19.0.0.3) as external service nulls were supported (xsi:nil="true"). Check what you are sending "over the wire" (networks sniffer). Please note that it works differently if you try manually serialize object to XML.
Then all attributes which are null or undefined are represented as not defined XML element ( "no blank tags")
Only empty strings are serialized to empty elements (e.g. when using tw.local.yourobject.toXMLString())
3. As somebody already said – contract between provider and client say what is allowed and what is not. If elements are not mandatory it can be omitted (and this is rather good practice as sometimes new client can be compatible with old provider when using this pattern).
4. If you are trying to do database update based on values from screen – then your interface should be carefully designed and you should send only delta (changed variables). But this is a contract between you and other party.
5. Based on what I said in point 2 (empty strings are serialized) if you re doing something not standard you can try brute force method and replace your nulls with empty strings. You can use fact that default serialization to JSON stores nulls:
tw.local.yourobject = JSON.parse ( tw.local.yourobject.toJSONString(true).replace(/null/g,"\"\"") );
However it will work for String type only and fields which have been set explicitly (field1 = null)
So I would not go into that direction. If you can influence service provider – interface should be changed and properly designed to fit your needs. If provider is something you don't control it is better to use Java client or different tooling between BPM and service provider (façade).
And check twice that your external service definition is properly imported.
6. And totally off topic: It should be not your problem what internally your service provider do. You should fulfill only WSDL contract. If provider have to internally send this very specific XML, it is provider issue how to create it :)
------------------------------
Sebastian Tylko
------------------------------
Original Message:
Sent: Wed September 23, 2020 10:39 AM
From: Atanu Roy
Subject: How to create blank XML from complex business object
I have a requirement - I am passing a complex business object as XML format to another system. BPM does not send blank tags in the XML for null attributes.
Is there any generic way to create blank tags for null attributes in BPM ?
------------------------------
Atanu Roy
------------------------------