Wednesday, May 11, 2011

Removal of Null Tags

A lot has been said and written about removing null tags in xml messages. Any integration ace will always suggest to go for XSLT to transform XML while an siebel eScript enthusiast will defend stating business service will be ideal way to achieve this. But a laggard like me is always in search of solution which is easier to implement and flexible enough to handle frequent changes. After peppering siebel forums one of my friend came up with devilicious idea of using the data mappers itself to remove the null tags.

As per siebel booskshelf:

"The Integration Component Fields list displays the list of fields for that component. Note the system fields Conflict Id, Created, Id, Mod Id, Updated, operation, and searchspec in the list. This setting prevents the EAI Siebel Adapter Query and QueryPage method from outputting these fields."

It says that system fields are not the part of output XML. Any integration field of type "System" is not included in the ouput siebel message of EAI Siebel Adapter. So key here is, if the tag is null we can replace it in datamapper with any system field.

Consider a scenario if description is blank in Service Request then we don't want Description Tag send to external system in the outbound message. In order to remove the null tag we can use following expression in the DataMap:

IIF([Description] IS NULL,[Created],[Description])

In this Description and Created are integration fields of IC. Created is of type System, so if description is coming as null then we are passing Created. Here as Created is system field it will not come up in the ouput message after conversion. Now one may say how to remove entire instance if all the tags are null. Siebel also has solution to that. Try out Source Search Expression for this scenario.

Happy Integration!!

PS: Watch Out for Vinay's world for XSLT to filter out null tags.

2 comments:

Anonymous said...

Can similar method be used to escape null values for inbound message to Siebel?

We have created multiple data maps depending on source and filter out based on source.

This is not a good solution if there would be many source sytems.

Siebelish said...

Hey Anonymous,
This will also work fine in inbound scenarios, provided you have defined integration field as of type System and it should not be present in incoming message.
It will work in multiple source system scenarios also provided your inbound hierarchy is consistent. Only additional overhead will be multiple conditions in DataMap.

As i also mentioned in my post its an alternate not a full proof solution. However if you can provide specific scenario for its failure it will be great for audience. Thanks for commenting.

Regards,
-Rahul-