Hide empty or null fields

Hi,

I’ve recreated a new webMethods web service based on a previous ESB Sonic web service.

All works well, except that with the new webservice, null fields are returned in the Response (with the previous web service, the null value fields were hidden, and we need the same working as before).

How may I make some null fields hidden with webMethods please ?
I have tried setting “Allow = True” and “Required = false” but the field is returning anyway in the response Document.

Regards

(I would appreciate to not have to change my mapping, testing value of the fields, etc…)

or maybe it is impossible to hide it with webMethods ?

Hi Cedric,

as long as a field is explicitly mapped (either by setting a value directly or by mapping) it will exist in the target structure.

When using mappings and the value does not exist on the source or is explicitly presented as empty, the target will have an empty field.

To avoid this you will have to test the field for emptyness and only map when it has a content.

This can be either done by Copy Conditions or by explictly branching of the field and check for $null (missing field) and “” (empty field).

Maybe there is an option use some sort of regex or a XSLT transformation to remove the empty fields after the mapping is finished.

Regards,
Holger

We can write a java code to get IData as input and recursively remove all null or empty fields and call it in end of the flow service.

Thanks… but I was thinking that the Designer could bring me a solution (a kind of attribute field).

Yes Venkata you’re right, I was considering to code that in Java (I didn’t see any other solution) because on some web services I have almost 500 concerned fields… :cry:

but I was hesitating between filling the null value with empty string… or just remove the fields…

Regards

Hum… and in Java, how may I know if a field is “Required”, “Allow null” please ?

I thought Ur initial requirement is to remove null fields in Response.

"
I’ve recreated a new webMethods web service based on a previous ESB Sonic web service.

All works well, except that with the new webservice, null fields are returned in the Response (with the previous web service, the null value fields were hidden, and we need the same working as before).
"

Yes, you’re right I’m going to remove the null fields.

but is there any way to test if that field si “required” or “allow null” before to remove it ?

I think the web service schema validations will throw errors if its required field

Ok I see. so if the field is not required, the removing will work well, otherwise the Exception will occur in webMethods ?

In addition, I’m just curious to know how to retrieve these informations for a more general need…
maybe it will help me, one day ?
is there any function for this kind of options ? ( getOptions(IData) )

Regards

IData is just a key/value pairs, I guess the constraints are not accessible at java IData object level.

Complete API is here,

http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite9-9/Integration_Server/9-9_Integration_Server_Java_API_Reference/index.html

so maybe at another level ?

(your link does not work for me but I will take a look at the Empower site)

Not that I know, will have to wait for other members to comment on it

this nothing urgent… not a problem… ok let’s wait :slight_smile:

thanks for your help.

Regards

Hi Cedric,

Did you get a solution ?

even we are facing the same issue.

Hi,

It has been a long time… I’ve forgotten the problem :wink:
More serioulsy, I think i’ve corrected the problem using the solution recommended by Holger (in this post)
Regards