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 » Convert into UTF8

Post new topic  Reply to topic Goto page 1, 2, 3, 4  Next
 Convert into UTF8 « View previous topic :: View next topic » 
Author Message
alethea
PostPosted: Wed Sep 25, 2013 6:05 pm    Post subject: Convert into UTF8 Reply with quote

Apprentice

Joined: 30 Jul 2007
Posts: 45

Hello All,

I want to convert specific element(IDocStreamData) of XMLNSC Msg (coming in thorough MQInput Node) to UTF 8 format.

Incoming Msg structure: XMLNSC.SapGenericIDocObject.IDocStreamData
IDocStreamData CCSID:913


I am using following in JCN to do it, but I am receiving same data as output.
Could you please help see the UTF output coming out of JCN node.
======================================
MbOutputTerminal out = getOutputTerminal("out");
MbMessage inMessage = contact admin.getMessage();

// create new message
MbMessage outMessage = new MbMessage(inMessage);
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin, outMessage);

try {

MbElement outRoot = outMessage.getRootElement();
MbElement outSapGenIdocObj = outRoot.getLastChild().getLastChild();
MbElement outIDocStreamData = outSapGenIdocObj.getFirstElementByPath("IDocStreamData");

String ccsid = "912";
Integer ccsidValue = new Integer(ccsid);
byte[] iDocByteStream = outIDocStreamData.toBitstream(null, null, null, 0, ccsidValue, 0);
String convertedData = new String(iDocByteStream, "UTF-8");
outIDocStreamData.setValue(convertedData);
out.propagate(outAssembly);
}
=========================================
Thank you for replying.
Back to top
View user's profile Send private message
aggarwal.intouch
PostPosted: Wed Sep 25, 2013 11:58 pm    Post subject: Reply with quote

Acolyte

Joined: 30 May 2011
Posts: 56
Location: India

I am not sure of the JCN but I used the following in my esql for converting the whole message in UTF8 format and it worked.

Code:
SET OutputRoot.Properties.CodedCharSetId = 1208;


Last edited by aggarwal.intouch on Thu Sep 26, 2013 12:27 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu Sep 26, 2013 12:20 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please use [c o d e] tags when posting code snippets - it makes it much easier to read your code. You can use the [edit] button to put them in now, if you like.

Quote:
I want to convert specific element(IDocStreamData) of XMLNSC Msg (coming in thorough MQInput Node) to UTF 8 format.
OK, I understand that statement. But what do you want to do with the resulting UTF-8 string? Do you want to emit an XML message, encoded in UTF-8, containing the converted data?
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
alethea
PostPosted: Thu Sep 26, 2013 2:05 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jul 2007
Posts: 45

Yes Kimbert.

I need to extract data from IDocStreamData and create an xml msg, topic etc from it and move the readable message in UTF 8 format ahead.

Thanks.
Back to top
View user's profile Send private message
alethea
PostPosted: Thu Sep 26, 2013 2:13 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jul 2007
Posts: 45

I need to make correction here.
I am getting hex strings as input in IDocStreamData .
So basically the task in JCN is to convert the hex string in UTF-8.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Sep 26, 2013 2:59 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You are trying to do too much work. Message Broker is smarter than you think.

You need to
- Build up your output message in OutputRoot.XMLNSC
- Set OutputRoot.Properties.CodedCharSetId to 1208 ( UTF-8 )
- Let the XMLNSC domain handle the encoding for you
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
alethea
PostPosted: Thu Sep 26, 2013 8:10 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Jul 2007
Posts: 45

No Kimbert,

Its not working that way. If I just set CCSID in properties folder to 1208, the data in output comes out same as data in input.

The data coming in as hex is latin and I dont want to hardcode the latin code page in esql.

Thanks for your help.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Thu Sep 26, 2013 10:03 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

What kimbert said above is correct, so maybe if you post a small example of the data you have in IDocStreamData and what you want to convert it to, then we can understand better what your problem is
Back to top
View user's profile Send private message
alethea
PostPosted: Fri Sep 27, 2013 9:49 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jul 2007
Posts: 45

Here is the sample data:
<IDocStreamData>4544495f444334302020303130303030
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Sep 27, 2013 10:35 am    Post subject: Reply with quote

Jedi Council

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

alethea wrote:
Here is the sample data:
<IDocStreamData>4544495f444334302020303130303030


Which looks like
Code:

45 44 49 5f 44 43 34 30 20 20 30 31 30 30 30 30
 E   D   I   _   D C   2   0  sp sp  0   1   0   0   0   0


Does this seem familiar?
_________________
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
dogorsy
PostPosted: Fri Sep 27, 2013 10:36 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

ok, and you want that to come out as :
Code:
EDI_DC40  010000
?
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Sep 27, 2013 10:37 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
so maybe if you post a small example of the data you have in IDocStreamData
Done. Thanks.
Quote:
and what you want to convert it to,
Not done. Please post the exact output that you want to receive.

hint: You are not thinking accurately about this problem. Try describing your input data more accurately.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
alethea
PostPosted: Fri Sep 27, 2013 10:48 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jul 2007
Posts: 45

If this is the input to compute node: 45 44 49 5f
The output from compute node should be "EDI" with CCSID 1208 in properties for further flows to read it.
Back to top
View user's profile Send private message
alethea
PostPosted: Fri Sep 27, 2013 10:52 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jul 2007
Posts: 45

Yes Dogorsy,
I want to come out as
Code:
EDI_DC40 010000
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Sep 27, 2013 11:07 am    Post subject: Reply with quote

Jedi Council

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

How does broker convert from one data type to another?
_________________
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
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3, 4  Next Page 1 of 4

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Convert into UTF8
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.