|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
converting xml message stored in global env to string. |
« View previous topic :: View next topic » |
Author |
Message
|
EAI Developer |
Posted: Mon Feb 27, 2012 2:45 pm Post subject: converting xml message stored in global env to string. |
|
|
 Centurion
Joined: 30 Nov 2005 Posts: 101 Location: US
|
Hi All
I am facing issue, while converting xml message, which is in global env to string, so that i can pass it to next application. I have tried using tobitstream function, but no help.
code :
Code: |
MbElement globalEnv = outAssembly.getGlobalEnvironment().getRootElement();
byte[] responseBytes1 = globalEnv.getFirstChild().toBitstream("","",MbXMLNSC.PARSER_NAME,0,0,0);
sRequestXml = new String(responseBytes1);
|
Env tree:
Code: |
Environment
AlertServiceRequest
xmlns:CHARACTER:urn:roaming
event:CHARACTER:1
xmlns:CHARACTER:
mdn_msisdn:CHARACTER:8049557864
xmlns:CHARACTER:
min_imsi
xmlns:CHARACTER:
realm_apn
xmlns:CHARACTER:
carrierId
xmlns:CHARACTER:
servicePackageName
xmlns:CHARACTER:
timeStamp:CHARACTER:2011-07-14T09:00:00
xmlns:CHARACTER:
type:CHARACTER:0
xmlns:CHARACTER:
tierNumber:CHARACTER:7
xmlns:CHARACTER:
tierThreshold:CHARACTER:12311
xmlns:CHARACTER:
volumeUsage:CHARACTER:0
xmlns:CHARACTER:
currencyUsage:CHARACTER:0
xmlns:CHARACTER:
billingCycleEndDate:CHARACTER:10
xmlns:CHARACTER:
bundleId:CHARACTER:2342
xmlns:CHARACTER:
bundleGroupId:CHARACTER:T
xmlns:CHARACTER:
|
xml :
Code: |
<AlertServiceRequest xmlns="urn:roaming">
<event xmlns="">1</event>
<mdn_msisdn xmlns="">8049557864</mdn_msisdn>
<min_imsi xmlns=""/>
<realm_apn xmlns=""/>
<carrierId xmlns=""/>
<servicePackageName xmlns=""/>
<timeStamp xmlns="">2011-07-14T09:00:00</timeStamp>
<type xmlns="">0</type>
<tierNumber xmlns="">7</tierNumber>
<tierThreshold xmlns="">12311000</tierThreshold>
<volumeUsage xmlns="">0</volumeUsage>
<currencyUsage xmlns="">0</currencyUsage>
<billingCycleEndDate xmlns="">10</billingCycleEndDate>
<bundleId xmlns="">2342</bundleId>
<bundleGroupId xmlns="">T</bundleGroupId>
</AlertServiceRequest>
|
I tried setting XMLNC parser with a new MbElement, then pass it to toBitstream function, but still no luck. _________________ ___________________
Regards,
EAI Developer. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 27, 2012 4:01 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You have given a lot of information, but you have missed out something important : what actually happened. Phrases like 'no help' and 'still no luck' don't help me to diagnose the problem
Also, your environment tree seems to have been copied and pasted from the debugger window (that's a guess). Trace node output is *much* more useful.
My best guess is that you did not assign the XMLNSC parser to the first child of the Environment tree( and some proper Trace node output would prove/disprove that theory ). You need to assign the parser when you create the syntax element - you cannot assign it later. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 28, 2012 6:53 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
if you're getting back an empty string from toBitstream() then the issue is as kimbert stated, that you didn't assign a parser to the tree. |
|
Back to top |
|
 |
adubya |
Posted: Tue Feb 28, 2012 6:55 am Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
This question seems to get asked weekly  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|