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 » MRM to XMLNC parser

Post new topic  Reply to topic Goto page 1, 2  Next
 MRM to XMLNC parser « View previous topic :: View next topic » 
Author Message
ydeonia
PostPosted: Tue May 07, 2013 2:23 am    Post subject: MRM to XMLNC parser Reply with quote

Acolyte

Joined: 29 Oct 2012
Posts: 74

Hi

I am subscribed to some messages which will send me an XML . To publish that XML MRM parser is used. Now I am trying to fetch the XML values to output XMl structure.

the input XML look like

Code:
<?xml version="1.0" encoding="UTF-8"?>
<NS1:BizData_Payload
  xmlns:NS1="http://www.mrf.com/schemas/technicalcomponent/eai/v1_0/eai.xsd"
  xmlns:NS2="http://www.mrf.com/schemas/client/v1_0/client.xsd"
  xmlns:NS3="http://www.mrf.com/schemas/core/v1_0/core.xsd"
  xmlns:NS4="http://www.mrf.com/schemas/organization/v1_0/organization.xsd"
  xmlns:NS5="http://www.mrf.com/schemas/productandservice/v1_1/productandservice.xsd"
  xmlns:NS6="http://www.xcbl.org/schemas/xcbl/v4_0/core/core.xsd"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NS1:BizHeader>
    <NS1:Business_Trans_Ids>
      <NS1:NameValuePair>
        <NS1:Name>ObjectID</NS1:Name>
        <NS1:Value>118595_101</NS1:Value>
        <NS1:Datatype>String</NS1:Datatype>
      </NS1:NameValuePair>
      <NS1:NameValuePair>
        <NS1:Name>ObjectTimestamp</NS1:Name>


I have written like

Code:
CREATE COMPUTE MODULE WMB_9D1_PRODKIT_SUB00_001
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
   CALL CopyMessageHeaders();
   --CALL CopyEntireMessage();
   DECLARE orgObj REFERENCE TO InputRoot.XMLNSC.BizData.BizData_Request.CAI;
   DECLARE rowCnt INTEGER 0;
      SET rowCnt = rowCnt+1;
   -- Construct Final Response XML
      SET OutputRoot.XMLNSC.root.(XML.Element)[1]='Kit';
       SET OutputRoot.XMLNSC.root.E2E.eventType = Environment.Variables.EventType;
       SET OutputRoot.XMLNSC.root.E2E.nativeId = Environment.Variables.NativeID;   
      SET OutputRoot.XMLNSC.root.row[rowCnt].Kit_info.productCd = FIELDVALUE(orgObj.(XMLNSC.Field)*:ListOfCAD.*:CAD.*:CAICode)||'_'||FIELDVALUE(orgObj.(XMLNSC.Field)*:ListOfCAD.*:CAD.*:CCIDCode);
      SET OutputRoot.XMLNSC.root.row[rowCnt].Kit_info.components.productCd = FIELDVALUE(orgObj.(XMLNSC.Field)*:ListOfCAD.*:CAD.*:CADAssemly.*:CADComponent.*:CAICode)||'_'||FIELDVALUE(orgObj.(XMLNSC.Field)*:ListOfCAD.*:CAD.*:CADAssemly.*:CADComponent.*:CCIDCode);
      SET OutputRoot.XMLNSC.root.row[rowCnt].Kit_info.components.quantity = FIELDVALUE(orgObj.(XMLNSC.Field)*:CAIAssembly.*:CAIComponent.*:Quantity);
      
   RETURN TRUE;
   END;


My desired output schema is


Code:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="root">
- <xs:complexType>
+ <xs:sequence>
  <xs:element ref="E2E" />
  <xs:element name="row" type="rowType" minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
  <xs:attribute name="name" />
  </xs:complexType>
  </xs:element>
- <xs:complexType name="rowType">
- <xs:sequence>
  <xs:element ref="Kit_Info" minOccurs="0" maxOccurs="1" />
  </xs:sequence>
  </xs:complexType>
- <xs:element name="Kit_Info">
- <xs:complexType>
- <xs:sequence>
  <xs:element ref="productCd" />
  <xs:element ref="components" minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
  </xs:complexType>
  </xs:element>
- <xs:element name="components">
- <xs:complexType>
- <xs:sequence>
  <xs:element ref="productCd" />
  <xs:element ref="quantity" />
  </xs:sequence>
  </xs:complexType>
  </xs:element>



But when I run the code and did trace it says

Code:
2013-05-07 17:49:01.596320 10064 UserTrace BIP5004E: An XML parsing error ''An invalid XML character (Unicode: 0xb4) was found in the prolog of the document.'' occurred on line 1 column 1 when parsing element ''/Root/XMLNSC''.
Internal error codes are '1504' and '2'.


Where is am wrong. Please guide.[/code]


Last edited by ydeonia on Tue May 07, 2013 11:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Tue May 07, 2013 2:36 am    Post subject: Reply with quote

Chevalier

Joined: 23 Jul 2008
Posts: 440
Location: Jamsa, Finland

Hi,

Do you know how to use Trace -node with ${Root} pattern to debug what kind of logical data tree comes out from your compute -node?

--
Marko
Back to top
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Tue May 07, 2013 3:07 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I am subscribed to some messages which will send me an XML . To publish that XML MRM parser is used.
You should not be using the MRM parser to write XML messages. Is there some reason why MRM is being used?

Quote:
2013-05-07 17:49:01.596320 10064 UserTrace BIP5004E: An XML parsing error ''An invalid XML character (Unicode: 0xb4) was found in the prolog of the document.'' occurred on line 1 column 1 when parsing element ''/Root/XMLNSC''.
Internal error codes are '1504' and '2'.
This error is often caused when the message flow is using the wrong CCSID. Check that the document really is in UTF-8, and then check that XMLNSC is using CCSID 1208 when it tries to parse the XML.
Back to top
View user's profile Send private message
ydeonia
PostPosted: Tue May 07, 2013 5:10 am    Post subject: Reply with quote

Acolyte

Joined: 29 Oct 2012
Posts: 74

[quote="kimbert"]
Quote:
Is there some reason why MRM is being used?


Quote:
This error is often caused when the message flow is using the wrong CCSID. Check that the document really is in UTF-8, and then check that XMLNSC is using CCSID 1208 when it tries to parse the XML.



Thanks kimbert,
can you please have a look at my compute node code for reading the xml.
I just have one concern. Is my code written is correct ? Actually as per now I am getting the blank xml structure without values.

Do I have to define the ccsid 1208 in esql?
Back to top
View user's profile Send private message
ydeonia
PostPosted: Tue May 07, 2013 5:22 am    Post subject: Reply with quote

Acolyte

Joined: 29 Oct 2012
Posts: 74

marko.pitkanen wrote:
Hi,

Do you know how to use Trace -node with ${Root} pattern to debug what kind of logical data tree comes out from your compute -node?

--
Marko


Can you show a tutorial on this or any documentation . I am using MQinput --> Floworder--> compute-->floworder-->output

so do you want me to add trace node in between Floworder-->trace-->compute
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue May 07, 2013 5:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You did not answer my first question ( you just quoted it ). Was that just a typing error?
Quote:
can you please have a look at my compute node code for reading the xml.
I cannot see your code. Even if I could see it, I don't have time to review it.

Please take time ( your time ) to ask questions that we can answer. Provide the required data. Don't waste our time.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue May 07, 2013 5:31 am    Post subject: Reply with quote

Grand High Poobah

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

ydeonia wrote:
I am using MQinput --> Floworder--> compute-->floworder-->output


Why are you using Floworder? How much about your flow are you not telling us?

As @kimbert has rightly pointed out, you're not providing enough infomation or answering our questions. We don't have the time or the access to go through your code (which for the record looks just contact admin).
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ydeonia
PostPosted: Tue May 07, 2013 7:30 am    Post subject: Reply with quote

Acolyte

Joined: 29 Oct 2012
Posts: 74

Vitor wrote:
ydeonia wrote:
I am using MQinput --> Floworder--> compute-->floworder-->output


Why are you using Floworder? How much about your flow are you not telling us?

As @kimbert has rightly pointed out, you're not providing enough infomation or answering our questions. We don't have the time or the access to go through your code (which for the record looks just contact admin).

There is nothing such I dont want to tell. Its 12 midnight here now. Tommorow I will post the flow also. I have shared all information so that I can get any help from you .

I am using floworder because there are many nodes connected . Since I am testing in local I have to remove the rest of the nodes from floworder and made it connect to compute in first order.

I have actually shared teh esql code above , I was just asking to see it if I took the right way to handle the xml.

Anyway I am always thank ful to this forum .
Back to top
View user's profile Send private message
mgk
PostPosted: Tue May 07, 2013 8:02 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
can you please have a look at my compute node code for reading the xml.


The error you posted is not really caused by your code - it looks like it is caused when your code looks at the input message - causing the input message to be parsed. As Kimbert said, check the ccsid of the incoming message.

Kind regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
ydeonia
PostPosted: Tue May 07, 2013 8:21 am    Post subject: Reply with quote

Acolyte

Joined: 29 Oct 2012
Posts: 74

mgk wrote:
Quote:
can you please have a look at my compute node code for reading the xml.


The error you posted is not really caused by your code - it looks like it is caused when your code looks at the input message - causing the input message to be parsed. As Kimbert said, check the ccsid of the incoming message.

Kind regards,


Hi

if you see the incoming message it says <?xml version="1.0" encoding="UTF-8"?>

encoding is UTF-8
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue May 07, 2013 9:00 am    Post subject: Reply with quote

Grand High Poobah

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

ydeonia wrote:
if you see the incoming message it says <?xml version="1.0" encoding="UTF-8"?>

encoding is UTF-8


No, the message has a declaration indicating it's in UTF-8.

That does nothing to demonstrate the actual message body is actually made up of UTF-8.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ydeonia
PostPosted: Tue May 07, 2013 9:05 am    Post subject: Reply with quote

Acolyte

Joined: 29 Oct 2012
Posts: 74

Vitor wrote:
ydeonia wrote:
if you see the incoming message it says <?xml version="1.0" encoding="UTF-8"?>

encoding is UTF-8


No, the message has a declaration indicating it's in UTF-8.

That does nothing to demonstrate the actual message body is actually made up of UTF-8.


is there is anyway to verify the encoding other than asking to source team?
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue May 07, 2013 9:44 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Root.Properties ? If not null.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue May 07, 2013 11:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Even if the input message *is* in UTF-8, it is quite possible that the MQMD header is setting some other CCSID. You should
- put a Trace node immediately after the input node
- set its pattern to ${Root}
- switch on user trace
- put a message through the flow
- read the user trace, which will include the Trace node output

The Properties folder in the Trace node output will contain InputRoot.Properties.CodedCharSetId. The MQInput node will set that value from the MQMD ( or whatever the final MQ header happens to be ). It should be set to 1208 or 1209 if the input message really is in UTF-8.

I still think you should tell us why you are continuing to use the MRM parser to write an XML message.
Back to top
View user's profile Send private message
ydeonia
PostPosted: Tue May 07, 2013 6:21 pm    Post subject: Reply with quote

Acolyte

Joined: 29 Oct 2012
Posts: 74

Code:
( ['MQROOT' : 0x75341f8]
  (0x01000000:Name  ):Properties = ( ['MQPROPERTYPARSER' : 0x19d35b0]
    (0x03000000:NameValue):MessageSet             = '' (CHARACTER)
    (0x03000000:NameValue):MessageType            = '' (CHARACTER)
    (0x03000000:NameValue):MessageFormat          = '' (CHARACTER)
    (0x03000000:NameValue):Encoding               = 0 (INTEGER)
    (0x03000000:NameValue):CodedCharSetId         = 850 (INTEGER)
    (0x03000000:NameValue):Transactional          = TRUE (BOOLEAN)
    (0x03000000:NameValue):Persistence            = FALSE (BOOLEAN)
    (0x03000000:NameValue):CreationTime           = GMTTIMESTAMP '2013-05-08 01:56:42.390' (GMTTIMESTAMP)
    (0x03000000:NameValue):ExpirationTime         = -1 (INTEGER)
    (0x03000000:NameValue):Priority               = 0 (INTEGER)
    (0x03000000:NameValue):ReplyIdentifier        = X'000000000000000000000000000000000000000000000000' (BLOB)
    (0x03000000:NameValue):ReplyProtocol          = 'MQ' (CHARACTER)
    (0x03000000:NameValue):Topic                  = NULL
    (0x03000000:NameValue):ContentType            = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourceType     = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourceToken    = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
    (0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedType     = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedToken    = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
    (0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
  )
  (0x01000000:Name  ):MQMD       = ( ['MQHMD' : 0x959df90]
    (0x03000000:NameValue):SourceQueue      = 'WMB.9D1.ASUB_PRODKIT_ACJ' (CHARACTER)
    (0x03000000:NameValue):Transactional    = TRUE (BOOLEAN)
    (0x03000000:NameValue):Encoding         = 0 (INTEGER)
    (0x03000000:NameValue):CodedCharSetId   = 850 (INTEGER)
    (0x03000000:NameValue):Format           = '        ' (CHARACTER)
    (0x03000000:NameValue):Version          = 2 (INTEGER)
    (0x03000000:NameValue):Report           = 0 (INTEGER)
    (0x03000000:NameValue):MsgType          = 8 (INTEGER)
    (0x03000000:NameValue):Expiry           = -1 (INTEGER)
    (0x03000000:NameValue):Feedback         = 0 (INTEGER)
    (0x03000000:NameValue):Priority         = 0 (INTEGER)
    (0x03000000:NameValue):Persistence      = 0 (INTEGER)
    (0x03000000:NameValue):MsgId            = X'414d5120514d32202020202020202020354a835120003921' (BLOB)
    (0x03000000:NameValue):CorrelId         = X'000000000000000000000000000000000000000000000000' (BLOB)
    (0x03000000:NameValue):BackoutCount     = 0 (INTEGER)
    (0x03000000:NameValue):ReplyToQ         = '                                                ' (CHARACTER)
    (0x03000000:NameValue):ReplyToQMgr      = 'QM2                                             ' (CHARACTER)
    (0x03000000:NameValue):UserIdentifier   = 'HP14910     ' (CHARACTER)
    (0x03000000:NameValue):AccountingToken  = X'1601051500000007e5306255855383828be8ef0204000000000000000000000b' (BLOB)
    (0x03000000:NameValue):ApplIdentityData = '                                ' (CHARACTER)
    (0x03000000:NameValue):PutApplType      = 11 (INTEGER)
    (0x03000000:NameValue):PutApplName      = '\HP14910\Desktop\rfhutil.exe' (CHARACTER)
    (0x03000000:NameValue):PutDate          = DATE '2013-05-08' (DATE)
    (0x03000000:NameValue):PutTime          = GMTTIME '01:56:42.390' (GMTTIME)
    (0x03000000:NameValue):ApplOriginData   = '    ' (CHARACTER)
    (0x03000000:NameValue):GroupId          = X'000000000000000000000000000000000000000000000000' (BLOB)
    (0x03000000:NameValue):MsgSeqNumber     = 1 (INTEGER)
    (0x03000000:NameValue):Offset           = 0 (INTEGER)
    (0x03000000:NameValue):MsgFlags         = 0 (INTEGER)
    (0x03000000:NameValue):OriginalLength   = -1 (INTEGER)
  )
  (0x01000000:Folder):XMLNSC     =



the error in debug says

Code:
Text:CHARACTER:An invalid XML character (Unicode: 0xb4) was found in the prolog of the document.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » MRM to XMLNC parser
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.