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 » How to save Json message into database?

Post new topic  Reply to topic
 How to save Json message into database? « View previous topic :: View next topic » 
Author Message
issac
PostPosted: Sat May 21, 2011 12:14 am    Post subject: How to save Json message into database? Reply with quote

Disciple

Joined: 02 Oct 2008
Posts: 158
Location: Shanghai

Hello,

HELP says Json Parser uses ASBITSTREAM for serialization too. However, I tried this and it's not working:

DECLARE taskValue CHARACTER InputRoot.JSON.Data.task;
DECLARE dataValue BLOB ASBITSTREAM(InputRoot.JSON.Data, InputRoot.properties.Encoding, InputRoot.properties.CodedCharSetId);
INSERT INTO Database.ISSAC.REQUEST_HISTORY(TASK, DATA, TIME, REQUEST_ID)
VALUES(taskValue, dataValue, 'qq', 'jj');

--------------------------
My message is:
{
"task":"list",
"data":
{
"checkedEventType":"GLOBAL",
"target":[
{"eventType":"#CALL",
"status":"-OPEN ",
"maxResult":10},
{
"eventType":"#TODO",
"status":"-OPEN ",
"maxResult":10}
]
}
}

As I trace the flow, InputRoot.JSON.Data.data is correctly parsed. But the variable dataValue is NULL.
_________________
Bazinga!
Back to top
View user's profile Send private message
issac
PostPosted: Sat May 21, 2011 3:23 pm    Post subject: Reply with quote

Disciple

Joined: 02 Oct 2008
Posts: 158
Location: Shanghai

any idea? please, thanks in advance.
_________________
Bazinga!
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat May 21, 2011 5:29 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

I thought ASBITSTREAM required an options parameter. I did not see you passing one.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
issac
PostPosted: Sat May 21, 2011 7:07 pm    Post subject: Reply with quote

Disciple

Joined: 02 Oct 2008
Posts: 158
Location: Shanghai

I remember that option too. But the statement is copied from Broker HELP for XMLNSC Parser.

Whatsoever I've dropped the idea to use Json parser. Lack of examples is one of the reasons. But the most important thing is that I've confirmed WMB does not support message modeling and validation for the Json Domain. I went for JSONML to convert Json into XML.
_________________
Bazinga!
Back to top
View user's profile Send private message
rekarm01
PostPosted: Sun May 22, 2011 3:03 am    Post subject: Re: How to save Json message into database? Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

issac wrote:
Code:
DECLARE dataValue BLOB ASBITSTREAM(InputRoot.JSON.Data, InputRoot.properties.Encoding, InputRoot.properties.CodedCharSetId);

"InputRoot.properties" is misspelled. The ENCODING and CCSID parameters are likely NULL. The JSON parser does not use the ENCODING parameter.

issac wrote:
As I trace the flow, InputRoot.JSON.Data.data is correctly parsed. But the variable dataValue is NULL.

If any ASBITSTREAM parameter is NULL, then the result is NULL.

fjb_saper wrote:
I thought ASBITSTREAM required an OPTIONS parameter.

It does not. The default value for the OPTIONS parameter is (RootBitStream & ValidateNone), in which case, the given field reference (InputRoot.JSON.Data) is also wrong.
Back to top
View user's profile Send private message
issac
PostPosted: Sun May 22, 2011 5:35 pm    Post subject: Reply with quote

Disciple

Joined: 02 Oct 2008
Posts: 158
Location: Shanghai

Hi! Thanks for the support.

I'll try specifying exact numbers as CCSID and encoding.
_________________
Bazinga!
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun May 22, 2011 9:35 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

issac wrote:
Hi! Thanks for the support.

I'll try specifying exact numbers as CCSID and encoding.

It's not about the exact number, what rekarm01 tried to tell you is that you need to spell properties in InputRoot.Properties with a capital 'P', and yes case does matter.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon May 23, 2011 3:22 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
issac wrote:
Hi! Thanks for the support.

I'll try specifying exact numbers as CCSID and encoding.

It's not about the exact number, what rekarm01 tried to tell you is that you need to spell properties in InputRoot.Properties with a capital 'P', and yes case does matter.


He's also saying that you can't use the default options to serialize part of a message tree. You need to specify FolderBitStream to serialize part of a message tree, rather than RootBitStream.

And I've not double-checked whether the JSON parser supports FolderBitStream either - it might or might not.
Back to top
View user's profile Send private message
dilse
PostPosted: Mon May 23, 2011 5:53 am    Post subject: Reply with quote

Master

Joined: 24 Jun 2004
Posts: 270

One other thing I noticed above is that you are trying to ASBITSTREAM "InputRoot.JSON.Data" but the actual field you mentioned being "InputRoot.JSON.Data.data".
_________________
DilSe..

Take life as it comes..
Back to top
View user's profile Send private message
namarn
PostPosted: Tue May 08, 2012 4:36 am    Post subject: Reply with quote

Newbie

Joined: 08 May 2012
Posts: 1

I also have similar requirement. I need to convert the JSON tree to a string. Is there a solution this?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue May 08, 2012 4:44 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

namarn wrote:
I also have similar requirement. I need to convert the JSON tree to a string. Is there a solution this?


Yes.

Use the proper options to ASBITSTREAM.

Or use an *Output node to serialize the logical message tree into a bitstream in some connectivity container (a message, a file, a tcp/ip stream, etc)
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue May 08, 2012 5:02 am    Post subject: Reply with quote

Jedi Knight

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

mqjeff wrote:
namarn wrote:
I also have similar requirement. I need to convert the JSON tree to a string. Is there a solution this?


Yes.

Use the proper options to ASBITSTREAM.

Or use an *Output node to serialize the logical message tree into a bitstream in some connectivity container (a message, a file, a tcp/ip stream, etc)


One option you may like to Google is called 'RootBitStream'.
_________________
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
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to save Json message into database?
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.