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 XML into DB by mapping?

Post new topic  Reply to topic
 How to save XML into DB by mapping? « View previous topic :: View next topic » 
Author Message
issac
PostPosted: Sat May 21, 2011 4:54 pm    Post subject: How to save XML into DB by mapping? Reply with quote

Disciple

Joined: 02 Oct 2008
Posts: 158
Location: Shanghai

Hello,

I've managed to save contents of the XML request into DB by ESQL like this:

CREATE COMPUTE MODULE dispatchRequest_Compute_to_Save_Request_History
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot = InputRoot;
--保存命令历史
DECLARE vasNs NAMESPACE 'http://futurehost.com/vas';
DECLARE taskChar CHARACTER InputRoot.XMLNSC.vasNs:RequestM.vasNs:task;
--保存请求报文
DECLARE propRef REFERENCE TO InputRoot.Properties;
DECLARE inCCSID INT propRef.CodedCharSetId;
DECLARE inEncoding INT propRef.Encoding;
DECLARE dataBlob BLOB ASBITSTREAM(InputRoot.XMLNSC, inEncoding, inCCSID);
DECLARE dataChar CHAR CAST(dataBlob AS CHAR CCSID inCCSID);
--使用MSG ID作为REQUEST_ID
DECLARE msgidChar CHARACTER Cast(InputRoot.MQMD.MsgId as CHARACTER);
--------------------------
INSERT INTO Database.ISSAC.REQUEST_HISTORY(TASK, DATA, TIME, REQUEST_ID)
VALUES(taskChar, dataChar, CURRENT_TIMESTAMP, msgidChar);
RETURN TRUE;
END;
END MODULE;

I'm trying to do the same thing by mapping. I think it should be similar. But I have no idea how to convert the message to BLOB and then CAST to a string in xpath. I'm still googling for an answer. Would anyone please help?
_________________
Bazinga!
Back to top
View user's profile Send private message
issac
PostPosted: Sat May 21, 2011 7:09 pm    Post subject: Reply with quote

Disciple

Joined: 02 Oct 2008
Posts: 158
Location: Shanghai

Any idea? Thanks in advance!
_________________
Bazinga!
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat May 21, 2011 9:30 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Please have a little patience. It is 06:30 Sunday here and most people who post here ate still fast asleep (or thinking about going to bed if they are in California etc). I'm only up as I have a big release coming up in three days.

You have posted essentially the same problem twice. The only difference being one relates to JSON and the other to XML. IMHO, the same solution will apply to both Format types.

I'm sure you have used the search utility on this forum and seen the large number of posts relating to ASBITSTREAM.

Why did you dismiss the use of things like FOLDERBITSTREAM etc in the ASBITSTREAM Options? I'd be interested to know why and if you have tried to solve your problem using them?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Sun May 22, 2011 3:26 am    Post subject: Re: How to save XML into DB by mapping? Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

issac wrote:
I've managed to save contents of the XML request into DB by ESQL ... I'm trying to do the same thing by mapping ... But I have no idea how to convert the message to BLOB and then CAST to a string in xpath.

Don't use XPath mapping functions. Use ESQL mapping functions, and Mapping node casts.
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 » How to save XML into DB by mapping?
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.