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 » XML to TDS tranformation

Post new topic  Reply to topic
 XML to TDS tranformation « View previous topic :: View next topic » 
Author Message
Sonal
PostPosted: Wed Dec 01, 2010 12:19 pm    Post subject: XML to TDS tranformation Reply with quote

Apprentice

Joined: 20 Mar 2009
Posts: 45

Hi Experts,

I need to do the transformation of an XML mesg into a tilde sperated text mesg i.e each field of xml would be separated by "~".

I achieved this by setting the Properties.MessageFormat = 'TDS' in my esql and setting the Messaging Standard as HL7 and delimiter as '~'.

Now, my question is, when I do like this, I couldnt validate the length of fields in tilde separated format (output) with the length of xml fields (input).

When we tranform a mesg from XML to Fixed record format, setting the wire format as CWF under the domain MRM, then in that case message set def takes care of the validation of the length constraint of fields in fixed record. However, I culdnt see this thing happening when I use TDS. It transforms the xml field without throwing any error even if the length of field is more than the length mentioned in message set.

Am I doing something wrong? Is there any way to validate the length of fields in xml with message set definition when we are using TDS?

Here is the sample of the same.
My xml is:

<Message>
<Employee>
<EmpId>1345634</EmpId>
<DOB>27-09-1985</DOB>
</Employee>
<Account>
<AccountNum>3567</AccountNum>
</Account>
</Message>


Now the max length of field EmpId is 5 bytes. But when I provide the field as mentioned in above xml that exceeds 5 bytes, I want that this should throw an error. Instead, it generates the transformed output as :

1345634~27-09-1985~3567.


Pls help.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 01, 2010 12:56 pm    Post subject: Re: XML to TDS tranformation Reply with quote

Grand High Poobah

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

Sonal wrote:
Am I doing something wrong? Is there any way to validate the length of fields in xml with message set definition when we are using TDS?


So why (if the field is delimited by tilde) is it also a fixed length? How does the receiving application process this?

Also why (if that's the case) have you not attempted to model this in the message set rather than just clicking on a dropdown and posting here when it didn't work?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sonal
PostPosted: Wed Dec 01, 2010 1:25 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Mar 2009
Posts: 45

Thank you so much for the reply.

Well, yes, the target end doesnt want it as fixed record. They just want to delimit the fields by 1~' and not by length.

HOwever, I did try to validate the length using mxsd. But, it didnt seem to be working.

Also, there si another scenario. XML->XML transformation. Here, I've tried both XML/XMLNSC and MRM domain with mesg format XML. But still it doesnt validate the field values with that of message set. It simply sends the xml from one end to another. Even if the max length defined in message set for a field is 12 and if I give the value that exceeds 12 bytes, it doesnt throw any exception/failure and is tranformed as it is.

I searched on net and also the Help in IBM MB, but cudnt come up with anything concrete except to try for MRM parsers. I tried with MRM too, but it worked the same way as XMLNSC.

Pls guide me or atleast pls suggest me the direction in which I should proceed so that I cud dig more in effective way.

Thanks a lot in advance.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 01, 2010 1:45 pm    Post subject: Reply with quote

Grand High Poobah

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

Sonal wrote:
HOwever, I did try to validate the length using mxsd. But, it didnt seem to be working.


No, because the model you provided only had the element delimited.

Sonal wrote:
It simply sends the xml from one end to another. Even if the max length defined in message set for a field is 12 and if I give the value that exceeds 12 bytes, it doesnt throw any exception/failure and is tranformed as it is.


How did you indicate to WMB that it should validate the XML against the message set?

Sonal wrote:
Pls guide me or atleast pls suggest me the direction in which I should proceed so that I cud dig more in effective way.


There's a couple of good posts in this forum on message modeling that may help. Also any post by kimbert is worth reviewing.

Also typing "validation" into the WMB InfoCenter search facility turns up a lot of good stuff. By an odd coincidence, the 1st 2 hits I got answered the 2 questions you posted here (though your 1st question would require a little additional reading. But it does give you the search term you should start with).
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 01, 2010 1:50 pm    Post subject: Reply with quote

Grand High Poobah

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

Sonal wrote:
Well, yes, the target end doesnt want it as fixed record. They just want to delimit the fields by 1~' and not by length.


Slightly off topic, but if this is the case what do you plan to do when validation fails? If this field is only supposed to be 12 bytes, but the target doesn't mind if it's 12,000 as long as there's a ~ at the end what would happen in business terms if broker fails the message? You'd need to invent some new means of telling whoever receives the output from the target there's a message missing because you've blown it out.

At the moment we assume the target either handles it by only using the first 12 bytes of the field, writing the record to an exception report or just blowing up. But there is an existing mechanism which won't react if you prevent the message passing through.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sonal
PostPosted: Wed Dec 01, 2010 2:23 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Mar 2009
Posts: 45

Huge thanks!


We do have error handling mechanism under which if the input XML mesg is not as per the message set def file, then it would give an exception. But this mechanism is present for XML->FR transformation where we use the ResetContentDescriptor Node and set the Message Format as CWF under the domain MRM. There it works. It checks the length of each field if it matches with the one mentioned in mxsd file.

But, for XML->XML, its not working. And in this case, the target end does care for the length of records.

IM going thru' the links you mentioned. Hope I'll get some solution for how to validate XML mesg against mxsd file.

Thankss...
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Dec 03, 2010 2:33 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I need to do the transformation of an XML mesg into a tilde sperated text mesg i.e each field of xml would be separated by "~".

I achieved this by setting the Properties.MessageFormat = 'TDS' in my esql and setting the Messaging Standard as HL7 and delimiter as '~'.
Setting Messaging Standard to 'HL7' seems wrong. Is your output data HL7? If not, you should simply set DataElementSeparation='All Elements Delimited' and set Delimiter='~'.

Quote:
When we tranform a mesg from XML to Fixed record format, setting the wire format as CWF under the domain MRM, then in that case message set def takes care of the validation of the length constraint of fields in fixed record. However, I culdnt see this thing happening when I use TDS. It transforms the xml field without throwing any error even if the length of field is more than the length mentioned in message set.

Am I doing something wrong? Is there any way to validate the length of fields in xml with message set definition when we are using TDS?
OK. You need to understand something important. WMB is different from other products that you may have used.
In WMB, the logical structure of the message is completely separate from its physical format. The CWF wire format is not 'validating' the lengths - it is simply trying to write the field into a fixed-length format and reporting an error because it is too long.
WMB can certainly validate the logical content of your message. It does this by applying XML Schema validation rules to the message tree. If you use XMLNSC and set Validation to 'Content and Value' then your input XML ( and output message tree, if you set Validation on the output node ) will be validated.

Quote:

Now the max length of field EmpId is 5 bytes. But when I provide the field as mentioned in above xml that exceeds 5 bytes, I want that this should throw an error. Instead, it generates the transformed output as :
Wrong. The max length is 5 *characters*. Please write this 100 times: 'a character is not the same as a byte'.
You probably meant 5 characters anyway. So you can get that validated as described above - just use XMLNSC and set Validation=Content And Value on the input node.
Back to top
View user's profile Send private message
Sonal
PostPosted: Fri Dec 10, 2010 12:45 pm    Post subject: Reply with quote

Apprentice

Joined: 20 Mar 2009
Posts: 45

Woww... thank you soo much.
This info was sooo useful

Im still collecting the pebbles along the sea shore... long way to go... need to study more n lots of hands-on...
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 » XML to TDS tranformation
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.