Author |
Message
|
wraymore |
Posted: Tue Feb 24, 2009 1:03 pm Post subject: Need to embed a MRM XML message in a XMLNSC wrapper - RSLVD |
|
|
Centurion
Joined: 16 Aug 2005 Posts: 114 Location: Burlington, NC USA
|
On WMB 6.0.0.8
We have a TDS formatted message (MRM TDS wire format message set) that is input to the process. The first step is to map some of the fields to XML (MRM XML wire format message set). Then embed the MRM XML within an outer XML that contains meta data about routing (XMLNSC). When I try to put the MRM XML within a CDATA tag, the output message does not show any of the MRM XML however a trace node prior shows it but the MRM tag is NULL. When I try without the CDATA tag, I get an error about specifying a namespace because the XMLNSC portion has Namespaces.
I do not have a namespace declared on the MRM message set.
Here is the mxsd of the MRM XML message set:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xs:element name="message">
<xs:annotation>
<xs:appinfo source="WMQI_APPINFO">
<MRMessage messageDefinition="/0/message;XSDElementDeclaration$MRObject"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence maxOccurs="1" minOccurs="1">
<xs:element name="type" type="xs:string"/>
<xs:element name="patient">
<xs:complexType>
<xs:sequence>
<xs:element name="lab" type="xs:string"/>
<xs:element name="specno" type="xs:string"/>
<xs:element name="worksheet" type="xs:string"/>
<xs:element name="wkshtversion" type="xs:string"/>
<xs:element name="patlname" type="xs:string"/>
<xs:element name="patfname" type="xs:string"/>
<xs:element name="dob" type="xs:string"/>
<xs:element name="age" type="xs:string"/>
<xs:element name="gender" type="xs:string"/>
<xs:element name="physid" type="xs:string"/>
<xs:element name="sampdate" type="xs:string"/>
<xs:element name="orders">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="order">
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="resulttype" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="results">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="result">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="code" type="xs:string"/>
<xs:element minOccurs="0" name="value" type="xs:string"/>
<xs:element minOccurs="0" name="type" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="abbrevs">
<xs:complexType>
<xs:sequence>
<xs:element name="abbrev" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="comments">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="comment" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
|
Here is my ESQL for CDATA:
Code: |
SET OutputRoot.XMLNSC.triadMsgNS:TriadMessage.triadMsgNS:TriadPayload.triadNS:Payload.(XMLNSC.CDataValue) = InputRoot.MRM; |
Excerpt from output message body:
Code: |
<NS1:TriadPayload><triadcommon:Payload type="XML" format="TEXT" version="1.0"></triadcommon:Payload></NS1:TriadPayload></NS1:TriadMessage> |
Excerpt from trace node:
Code: |
(0x01000000)http://www.labcorp.com/02/11/2008/V1/TriadMessage.xsd:TriadPayload = (
(0x01000000)http://www.labcorp.com/02/11/2008/V1/TriadCommon.xsd:Payload = (
(0x03000100):type = 'XML'
(0x03000100):format = 'TEXT'
(0x03000100):version = '1.0'
(0x02000001):MRM = NULL
(
(0x03000000):type = 'O'
(0x01000000):patient = (
(0x03000000):lab = 'RN'
(0x03000000):specno = '043G4202120'
(0x03000000):patlname = 'PATIENT'
(0x03000000):patfname = 'ONE'
(0x03000000):dob = '19690515'
(0x03000000):age = '0390828'
(0x03000000):gender = 'F'
(0x03000000):sampdate = '200902121111'
(0x01000000):orders = (
(0x01000000):order = (
(0x03000000):code = '980005'
(0x03000000):name = 'Histology Tracking'
(0x03000000):resulttype = ' ' |
Here is my ESQL without the CDATA:
Code: |
SET OutputRoot.XMLNSC.triadMsgNS:TriadMessage.triadMsgNS:TriadPayload.triadNS:Payload = InputRoot.MRM; |
Get this error:
Code: |
BIP5104: Element must have a namespace specified if there is a default namespace in scope |
Excerpt from trace node:
Code: |
(0x01000000)http://www.labcorp.com/02/11/2008/V1/TriadMessage.xsd:TriadPayload = (
(0x01000000)http://www.labcorp.com/02/11/2008/V1/TriadCommon.xsd:Payload = (
(0x03000000):type = 'O'
(0x01000000):patient = (
(0x03000000):lab = 'RN'
(0x03000000):specno = '043G4202120'
(0x03000000):patlname = 'PATIENT'
(0x03000000):patfname = 'ONE'
(0x03000000):dob = '19690515'
(0x03000000):age = '0390828'
(0x03000000):gender = 'F'
(0x03000000):sampdate = '200902121111'
(0x01000000):orders = (
(0x01000000):order = (
(0x03000000):code = '980005'
(0x03000000):name = 'Histology Tracking'
) |
Any will be appreciated!!!!!
Last edited by wraymore on Tue Feb 24, 2009 2:01 pm; edited 1 time in total |
|
Back to top |
|
 |
chids |
Posted: Tue Feb 24, 2009 1:15 pm Post subject: Re: Need to embed a MRM XML message within a XMLNSC wrapper |
|
|
 Novice
Joined: 09 Oct 2006 Posts: 22 Location: Stockholm, Sweden
|
wraymore wrote: |
On WMB 6.0.0.8
We have a TDS formatted message (MRM TDS wire format message set) that is input to the process. The first step is to map some of the fields to XML (MRM XML wire format message set). Then embed the MRM XML within an outer XML that contains meta data about routing (XMLNSC). When I try to put the MRM XML within a CDATA tag, the output message does not show any of the MRM XML however a trace node prior shows it but the MRM tag is NULL. When I try without the CDATA tag, I get an error about specifying a namespace because the XMLNSC portion has Namespaces.
|
Let me see if I understand what you're trying to do. You have a MRM XML tree which you'd like to serialize (ie produce actual XML) into a specific element within a XMLNSC tree? _________________ /mårten.
-- http://marten.gustafson.pp.se/
-- marten.gustafson@gmail.com |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 24, 2009 1:20 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You might want to look at XMLNSC.AsIsElementContent rather than PCDataSection.
Or base64 encoding. |
|
Back to top |
|
 |
wraymore |
Posted: Tue Feb 24, 2009 1:23 pm Post subject: |
|
|
Centurion
Joined: 16 Aug 2005 Posts: 114 Location: Burlington, NC USA
|
|
Back to top |
|
 |
wraymore |
Posted: Tue Feb 24, 2009 1:59 pm Post subject: |
|
|
Centurion
Joined: 16 Aug 2005 Posts: 114 Location: Burlington, NC USA
|
Thanks chids for the pointer of serialize. I found this link through DeveloperWorks: http://www-01.ibm.com/support/docview.wss?uid=swg21214413 (Embedding part of an XML message in an output XML CDATA section). I have resolved my issue.
mqJeff, thanks for your reply also, I will try your suggestions and see which management prefers.
 |
|
Back to top |
|
 |
chids |
Posted: Tue Feb 24, 2009 2:17 pm Post subject: |
|
|
 Novice
Joined: 09 Oct 2006 Posts: 22 Location: Stockholm, Sweden
|
Glad to have helped, you're more to than welcome to explain how you solved it. Did you do it with ESQL and the ASBITSTREAM function?
Also, I was about to ask you why you didn't simply map your MRM TDS directly to a XMLNSC tree - assuming there's a smooth way to do that with your scenario. _________________ /mårten.
-- http://marten.gustafson.pp.se/
-- marten.gustafson@gmail.com |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 25, 2009 3:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
chids wrote: |
Also, I was about to ask you why you didn't simply map your MRM TDS directly to a XMLNSC tree - assuming there's a smooth way to do that with your scenario. |
As his original post said he had tried that part but hit the "namespace not set with a default namespace in scope" legitimate problem and probably did not want to set the default namespace throughout the MRM tree.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
chids |
Posted: Wed Feb 25, 2009 10:59 am Post subject: |
|
|
 Novice
Joined: 09 Oct 2006 Posts: 22 Location: Stockholm, Sweden
|
fjb_saper wrote: |
chids wrote: |
Also, I was about to ask you why you didn't simply map your MRM TDS directly to a XMLNSC tree - assuming there's a smooth way to do that with your scenario. |
As his original post said he had tried that part but hit the "namespace not set with a default namespace in scope" legitimate problem and probably did not want to set the default namespace throughout the MRM tree.  |
I was way past my bedtime yesterday. You're absolutely right, and the link also stated how it was solved. Sorry about not reading (or thinking) properly. _________________ /mårten.
-- http://marten.gustafson.pp.se/
-- marten.gustafson@gmail.com |
|
Back to top |
|
 |
wraymore |
Posted: Fri Feb 27, 2009 5:39 am Post subject: |
|
|
Centurion
Joined: 16 Aug 2005 Posts: 114 Location: Burlington, NC USA
|
Here is my code that resolved my issue:
Code: |
DECLARE OrderBlob BLOB ASBITSTREAM(InputRoot.MRM,
InputRoot.MQMD.Encoding,
InputRoot.MQMD.CodedCharSetId,
InputRoot.Properties.MessageSet,
InputRoot.Properties.MessageType,
InputRoot.Properties.MessageFormat,
FolderBitStream);
DECLARE OrderChar CHAR CAST(OrderBlob AS CHAR CCSID InputRoot.MQMD.CodedCharSetId);
SET OutputRoot.XMLNSC.triadMsgNS:TriadMessage.triadMsgNS:TriadPayload.triadNS:Payload.(XMLNSC.CDataValue) = OrderChar; |
Many Thanks!!!  |
|
Back to top |
|
 |
|