cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Function Doubt

former_member186851
Active Contributor
0 Kudos

Dear SCN Users,

What are the below Fuctions and the uses in the Graphical Mapping.

Boolean- isNil

Constants- XSI:Nil.

Let me know the use cases,Any link or example also should be fine.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Raghu,

  • When you want to add xsi:nil="true" to an element in the target message you can use xsi:nil function because some external web services need in this format.


<element xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></element>

Check below blog for more details.

Check below i am passing xsi:nil function to body element

The output contains xsi:nil attribute the target element.

  • If you get the element like above in source message to check the element contain xsi:nil="true" then you need to use isNil function.

I am checking is element name1 contains xsi:nil attribute or not using isNil function.

The output return true.

Regards,

Praveen.

iaki_vila
Active Contributor
0 Kudos

Hi everyone,

I really didn't know this possibility, thanks Praveen for the clarification and Raghuraman for the question.

If i understand right the xis:nil constant function is used when you want to generate a tag but you can't not have the source tag (i didn't see the difference against use an empty constant tag).

The boolean isNil, if you have a false value, will you have a targe tag with false value? or with false value the tag will not be generated?. If the behavior is the first assumption, I didn't see either in which cases this can be helpful.

Regards.


former_member186851
Active Contributor
0 Kudos

Thanks a lot Praveen,Excellent Information.

former_member186851
Active Contributor
0 Kudos

Ya Inaki,Just was going through all the functions and these 2 were something interesting and I was not able to understand.

former_member186851
Active Contributor
0 Kudos

But Praveen the second one when we will use?

The first one to add to Soap requests if I am not wrong.

iaki_vila
Active Contributor
0 Kudos

Hi Raghuraman,

Right now you have throwed a doubt in me , do you see any circumstance in which boolean isNil is useful?.

And according the blog shared by Praveen and if you can use the constant function with empty, the unique sense to use the xis:nil constant is when the receiver system need this kind of tag?

Regards.

former_member186851
Active Contributor
0 Kudos

Ya Inaki,

I guess you missed my another comment.I asked the same to Praveen.

But Praveen the second one when we will use?

The first one to add to Soap requests if I am not wrong.

Answers (1)

Answers (1)

former_member182412
Active Contributor
0 Kudos

Hi Ragu/Inaki,

Some web services more strict in field validation they treat differently for below two cases.

  • Element with empty content (<element></element>)
  • Element with null (xsi:nil element with no content and that elements content type normally doesn't allow empty elements)

        (<element xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">                             </element>)

So for those web services element with null fields we need to send xsi:nil="true" using function xsi:nil constant function like below.

This example is if the field does not exist the web service needs xsi:nil="true" attribute in their field, this is one of the use case for xsi:nil constant function.

The same web service when they send the data to PI system, some of the null fields they will send xsi:nil="true" in their XML.

If they send xsi:nil="true" then we need to send blank value to the receiver using isNil boolean function, this is one of the use case for isNil boolean function.

I hope i clarify your query.

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Thanks once again Praveen.So will be used only in webservice scenarios right?

former_member182412
Active Contributor
0 Kudos

Hi Raghu,

Not only web services any system which expects in the above format.

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Thanks once again Praveen.