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 » Reading the XML msg

Post new topic  Reply to topic Goto page 1, 2  Next
 Reading the XML msg « View previous topic :: View next topic » 
Author Message
mqlover
PostPosted: Fri Jan 04, 2013 12:42 am    Post subject: Reading the XML msg Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Hi,

I have a requirement where in I will have to read one field from the XML msg and use it my ESQL for further computation.
If I use the XMLNSC parser then it I am getting the error i.e "XML Parsing Errors have occurred" and getting an Exception saying that the namespaces need to be declared.
The msg sender end have not declared any Namespaces so they have no idea reg teh declaration of namespaces.
Could anyone help me out how to read the msg as the msg contains Namespaces and there are different namespaces for different msgs.
Ex : cr - credit, dd - direct debit etc.

Thanks in advance
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Jan 04, 2013 12:52 am    Post subject: Reply with quote

Chevalier

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

Hi,

What version of broker you are using?

--
Marko


Last edited by marko.pitkanen on Fri Jan 04, 2013 12:53 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
smdavies99
PostPosted: Fri Jan 04, 2013 12:52 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.

What version & patch level of broker are you using?

Is the XML valid?
Can you give us an example of the incoming message?
What is the FULL ERROR TEXT shown in a UserTrace output? There are several lines of data. We really need to see it all.

Quote:

The msg sender end have not declared any Namespaces so they have no idea reg teh declaration of namespaces.
Could anyone help me out how to read the msg as the msg contains Namespaces and there are different namespaces for different msgs.


I am a bit confused here. firstly you say that they have not declared any namespaces then you say 'read as the msg contains Namespaces'.
Which of those statements is true?
_________________
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
mqlover
PostPosted: Fri Jan 04, 2013 1:15 am    Post subject: Reading the XML msg Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

This is the sample xml msg.
I am trying to read the value in bp:OrgnlInstrId but am getting the errors saying "XML Parsing Errors have occurred".

<BankStatementResponse>
<bp:BankStmtResp>
<bp:StmtResp>
<bp:OrgnlInstrId>20110311BKBBSGSGBAD0000010</bp:OrgnlInstrId>
</bp:StmtResp>
</bp:BankStmtResp>
</BankStatementResponse>

Broker version is 7.0.0.3.
I have not declared any namespaces. I am getting the error "bp" namespace not declared.
I am not allowed to use trace nodes, hence cannot provide the trace output.
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Jan 04, 2013 1:25 am    Post subject: Reply with quote

Chevalier

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

What is your ESQL statement you are using to access the OrgnlInstrId -element?

--
Marko
Back to top
View user's profile Send private message Visit poster's website
mqlover
PostPosted: Fri Jan 04, 2013 1:41 am    Post subject: Reading the XML msg Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

SET Environment.Variables.UUID = InputRoot.XMLNSC.BankStatementResponse.bp:BankStmtResp.bp:StmtResp.bp:OrgnlInstrId;
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Jan 04, 2013 1:44 am    Post subject: Reply with quote

Chevalier

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

Hi,

With closer look to your data, it seems that it is not possible to parse with namespace aware parser, because namespace prefix bp: is not defined in the data.

You have two options:
1) Ask message sender to declare prefix in the data or
2) use deprecated XML domain which do not care about undefined namespace prefixes.

I think that the option 1) is the preferred way to solve this problem.

--
Marko
Back to top
View user's profile Send private message Visit poster's website
mqlover
PostPosted: Fri Jan 04, 2013 1:50 am    Post subject: Reading the XML msg Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

I tried both the options :
1 . The user refused to give the namespace declaration.
2 . I tried to Use XML deprecated parser. There were no errors but the below field was not populated.

SET Environment.Variables.UUID = InputRoot.XML.BankStatementResponse.bp:BankStmtResp.bp:StmtResp.bp:OrgnlInstrId;

Thanks
Back to top
View user's profile Send private message
kash3338
PostPosted: Fri Jan 04, 2013 1:51 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Can you try this,

Code:

SET Environment.Variables.UUID = InputRoot.XMLNSC.BankStatementResponse.*:BankStmtResp.*:StmtResp.*:OrgnlInstrId;
Back to top
View user's profile Send private message Send e-mail
mqlover
PostPosted: Fri Jan 04, 2013 2:25 am    Post subject: Reading the XML msg Reply with quote

Disciple

Joined: 25 Jul 2010
Posts: 176

Nope, am getting the same error again!!
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Jan 04, 2013 2:27 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

This problem is nothing to do with message broker - it is caused by the user sending badly-formed XML. Any XML parser, from any vendor, will report an error for that XML. If you don't believe me, try viewing the XML file using a browser and see what happens.
Quote:
The user refused to give the namespace declaration.
Did they just refuse, or did they give you a reason why it cannot be done?
Back to top
View user's profile Send private message
marko.pitkanen
PostPosted: Fri Jan 04, 2013 3:02 am    Post subject: Reply with quote

Chevalier

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

Hi,

If you really need to take option 2) you have to refer to element with following format
Code:
InputRoot.XML.BankStatementResponse."bp:BankStmtResp"."bp:StmtResp"."bp:OrgnlInstrId";



Quote:
Because the names used must be valid ESQL identifiers, you can use only names that conform to the rules of ESQL. That is, the names can contain only alphanumeric characters including underscore, the first character cannot be numeric, and names must be at least one character long. You can avoid these limitations by enclosing names not conforming to these rules in double quotation marks. For example:

InputRoot.XMLNS."Customer Data".Invoice


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

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

kash3338 said:
Quote:
Can you try this,

Code:
SET Environment.Variables.UUID = InputRoot.XMLNSC.BankStatementResponse.*:BankStmtResp.*:StmtResp.*:OrgnlInstrId;

That would help if there was a message tree containing namespaces. The problem is that the incoming XML is badly-formed, so it cannot be parsed. No message tree is available.
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Jan 04, 2013 3:25 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

kash3338 said:
Quote:
Can you try this,

Code:
SET Environment.Variables.UUID = InputRoot.XMLNSC.BankStatementResponse.*:BankStmtResp.*:StmtResp.*:OrgnlInstrId;

That would help if there was a message tree containing namespaces. The problem is that the incoming XML is badly-formed, so it cannot be parsed. No message tree is available.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Fri Jan 04, 2013 3:47 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

XML is a strict standard: The sender must remove the prefixes "ns1:..." or add the namespace declarations "xmlns:ns1=..."

It would be totally against this idea if you'd take their msg in (using the BLOB-domain), fix (their) issues and then use a reset content descriptor to set to XMLNSC.
_________________
Just use REFERENCEs
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 » Reading the XML msg
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.