Author |
Message
|
DELLIPIZ |
Posted: Wed Mar 16, 2005 1:06 pm Post subject: XML namespace problem |
|
|
Acolyte
Joined: 08 Oct 2003 Posts: 70
|
Hi,
I am doing a transformation from XML to MRM with WMQI 2.1
My input XML uses namespaces. Here is the input XML:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addresssing">
<soapenv:Body>
<FindCreditStatus environment="Production" lang="en" revision="1.1.1" xmlns="http://www.ibm.com/xmlns/ims1">
<ApplicationArea>
<ns1:CreationDateTime xmlns:ns1="http://www.openapplications.org/oagis">2004-09-24T12:35:19.777-04:00</ns1:CreationDateTime>
<ns2:BODId xmlns:ns2="http://www.openapplications.org/oagis">APMC-65522B</ns2:BODId>
<Application>
<ApplicationStatus>
<StatusId>CreditResponse</StatusId>
</ApplicationStatus>
</Application>
</ApplicationArea>
<DataArea>
<ns3:Show confirm="Always" xmlns:ns3="http://www.openapplications.org/oagis"/>
<CreditRequest>
<Header>
<ns4:DocumentIds xmlns:ns4="http://www.openapplications.org/oagis">
<ns4:BrokerDocumentId>
<ns4:Id>0313DC338EB853FC85256F1900000A9A</ns4:Id>
</ns4:BrokerDocumentId>
<ns4:DocumentId>
<ns4:Id>CR000000110b</ns4:Id>
<ns4:Revision>1</ns4:Revision>
</ns4:DocumentId>
</ns4:DocumentIds>
<ns5:Parties xmlns:ns5="http://www.openapplications.org/oagis">
<ns5:CustomerParty active="true" oneTime="true">
<ns5:Name>FUJI SEAL EUROPE LTD</ns5:Name>
</ns5:CustomerParty>
<ns5:SupplierParty>
<ns5:Contacts>
<ns5:ContactAbs>
<ns5:EMailAddress sequence="1">shaziap@uk.ibm.com</ns5:EMailAddress>
</ns5:ContactAbs>
</ns5:Contacts>
</ns5:SupplierParty>
</ns5:Parties>
<CreditPaymentRequest>
<PaymentDeferral>
<Duration>0</Duration>
</PaymentDeferral>
<LeaseTerms>
<LeaseTime>
<Duration>36</Duration>
</LeaseTime>
</LeaseTerms>
</CreditPaymentRequest>
</Header>
<Line>
<ns6:LineNumber xmlns:ns6="http://www.openapplications.org/oagis">1</ns6:LineNumber>
<OrderItem>
<ItemType>IBM Hardware</ItemType>
</OrderItem>
<TotalAmount currency="GBP">113000</TotalAmount>
</Line>
</CreditRequest>
</DataArea>
</FindCreditStatus>
</soapenv:Body>
</soapenv:Envelope>
Since I don't know if 'ns3:Show' will always be that. It could be 'ns4:Show', or something else, how would I set my MRM field to that value?
So, for example, what ESQL code can I put to pull the value 'CR000000110b' from <ns4:Id>CR000000110b</ns4:Id>
when the '4' in 'ns4' could change?
Thanks in advance for your help!!!!
-Lori |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 16, 2005 1:09 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The namespace shorthands in the Input message, when using the XMLNS domain, are not copied to the Logical Message tree. The Logical Message Tree is built using the full namespace qualifier (like http://www.openapplications.org/oagis":Show).
You can declare your own schema shortcuts, and use those in your ESQL.
Try putting a trace node after your Input node, and examining the trace output to understand what the parsed tree looks like. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
TonyD |
Posted: Wed Mar 16, 2005 1:45 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
If the sender of the message was to add an attribute such as:
Code: |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addresssing"
[b]xmlns:oagis="http://www.openapplications.org/oagis"[/b]>
|
:the various 'ns-:' prefixes would be replaced by 'oagis:' which might solve your problem. |
|
Back to top |
|
 |
DELLIPIZ |
Posted: Wed Mar 16, 2005 2:26 pm Post subject: |
|
|
Acolyte
Joined: 08 Oct 2003 Posts: 70
|
Hi,
Unfortunately, we don't think the sender is going to be able to change the XML.
Jeff, per your suggestion, I changed the Domain in the MQInput node to XMLNS, but it failed during deploy. Is that what you were saying to try???
This was the error we got:
BIP2293E: Invalid configuration message containing attribute value 'XMLNS': not valid for target attribute 'messageDomainProperty' on object 'TEST_NAMESPACE.MQInput1'.
The message broker received a configuration message containing an attribute value which is not valid for the target attribute 'messageDomainProperty' on an object on this broker. The value is case sensitive and must match one of the parsers registered with this broker.
Is this a plug-in that we would need to install on our Z/os broker. Again, we are on WMQI 2.1.
If you have any other suggestions for parsing these dynamic XML tag names (ns#), I would really appreciate it!
Thanks!
-Lori |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 17, 2005 1:51 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Since I don't know if 'ns3:Show' will always be that. It could be 'ns4:Show', or something else, how would I set my MRM field to that value?
|
solution is
Code: |
DECLARE ns1 NAMESPACE "http://www.openapplications.org/oagis"
|
then you can refer to 'ns1:Show' in your ESQL paths.
It's up to you what prefix you use in your ESQL. You could just as easily use
Code: |
DECLARE oagis NAMESPACE "http://www.openapplications.org/oagis"
|
and refer to 'oagis:Show'
Oh, and the MRM XML parser is namespace-aware, so there's no need to switch to XMLNS in order to do this. |
|
Back to top |
|
 |
mgk |
Posted: Thu Mar 17, 2005 4:37 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Note that the above information is only valid for V5 Message Broker, not V2.1, but I',m not sure what the right answer is for 2.1... _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Mar 17, 2005 4:42 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
mgk is quite right - sorry for any confusion  |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 17, 2005 5:26 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I missed that 2.1.
XMLNS is not valid for 2.1.
2.1 has only poor support for namespaces.
You probably have a strong business case for moving to v5 - as it is going to take a lot of work to handle this well in 2.1 - the best way I can think of is to write a custom parser. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|