ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » [solved] modelling CWF message with mandatory fields

Post new topic  Reply to topic
 [solved] modelling CWF message with mandatory fields « View previous topic :: View next topic » 
Author Message
j.f.sorge
PostPosted: Mon May 18, 2009 12:07 am    Post subject: [solved] modelling CWF message with mandatory fields Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

Hello!

I have imported a COBOL copy book to create a CWF message. This message contains a header with mandatory fields. I tried to model this by setting Nillable to false and minOccurs / maxOccurs to 1 and a padding / encoding null value of SPACE. When I try to validate a message containing only SPACES in a mandatory field I thought the validation to fail but it parses correctly.

Does anyone know how to model such a field in CWF?

Thanks in advance!
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0


Last edited by j.f.sorge on Mon May 18, 2009 4:37 am; edited 1 time in total
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 18, 2009 12:24 am    Post subject: Re: modelling CWF message with mandatory fields Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

j.f.sorge wrote:
When I try to validate a message containing only SPACES in a mandatory field I thought the validation to fail but it parses correctly.


Am I correct in saying the intention here if for the message set to fail parsing if this field is present but space filled; i.e. it's not the field that's mandatory but it's content?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
j.f.sorge
PostPosted: Mon May 18, 2009 12:29 am    Post subject: Re: modelling CWF message with mandatory fields Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

Vitor wrote:
j.f.sorge wrote:
When I try to validate a message containing only SPACES in a mandatory field I thought the validation to fail but it parses correctly.


Am I correct in saying the intention here if for the message set to fail parsing if this field is present but space filled; i.e. it's not the field that's mandatory but it's content?

Yes, you are right. Parsing / validating should fail if the content of the field is only SPACE / null.
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 18, 2009 12:43 am    Post subject: Re: modelling CWF message with mandatory fields Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

j.f.sorge wrote:
Yes, you are right. Parsing / validating should fail if the content of the field is only SPACE / null.


And you have the validation set to content and value?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
j.f.sorge
PostPosted: Mon May 18, 2009 1:14 am    Post subject: Re: modelling CWF message with mandatory fields Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

Vitor wrote:
And you have the validation set to content and value?

I am using WMB 6.0.0.3 with a subflow to validate the messages. This subflow contains a ResetContentDescriptorNode with Parse timing=complete and a ValidateNode afterwards with Validate=Content and Value.
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 18, 2009 2:24 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I tried to model this by setting Nillable to false and minOccurs / maxOccurs to 1 and a padding / encoding null value of SPACE
You have misunderstood the null handling properties. The null handling facilities of the MRM parser allow you to specify what a null value looks like.
If the MRM parser finds that the input matches the literal or logical null value, then it will set the value in the message tree to NULL.
Similarly, when writing a message, if the message tree element contains the value NULL the output bit stream will contain the appropriate bytes.

Your requirement is nothing to do with null handling; you can forget Nillable and Encoding Null. You want to check that the value of a field is correct. You can do that in the following ways:
- set the logical type to some non-string type ( such as xs:int ). If the input is not a valid number, it will be reported as a data conversion error.
- create a simple type based on xs:string and and add Value Constraints ( same as XML Schema facets ) to it. Without knowing what 'valid' means I cannot suggest what those should be.
Back to top
View user's profile Send private message
j.f.sorge
PostPosted: Mon May 18, 2009 2:30 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

kimbert wrote:
Your requirement is nothing to do with null handling; you can forget Nillable and Encoding Null. You want to check that the value of a field is correct. You can do that in the following ways:
- set the logical type to some non-string type ( such as xs:int ). If the input is not a valid number, it will be reported as a data conversion error.
- create a simple type based on xs:string and and add Value Constraints ( same as XML Schema facets ) to it. Without knowing what 'valid' means I cannot suggest what those should be.

The values which I get in the message are all of xs:string type and I do not know a list of correct values. The only thing I want to check is if the field does only contain SPACES. If this is true validation should fail.
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon May 18, 2009 2:35 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Then add a pattern Value Constraint to your simple type to express that rule.
Back to top
View user's profile Send private message
j.f.sorge
PostPosted: Mon May 18, 2009 4:26 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

kimbert wrote:
Then add a pattern Value Constraint to your simple type to express that rule.

Thanks a lot! That helped me out.

Adding a minimum length of 1 to the type definition lets messages fail which have only SPACES.
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 18, 2009 4:33 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

j.f.sorge wrote:
Adding a minimum length of 1 to the type definition lets messages fail which have only SPACES.


Unless it's a field 10 characters long space filled I imagine....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » [solved] modelling CWF message with mandatory fields
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.