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 » IIB How can embed the converted xml message in CData section

Post new topic  Reply to topic
 IIB How can embed the converted xml message in CData section « View previous topic :: View next topic » 
Author Message
MrLight
PostPosted: Sat Aug 13, 2022 4:23 am    Post subject: IIB How can embed the converted xml message in CData section Reply with quote

Novice

Joined: 04 Aug 2022
Posts: 14

Hello Dears ,

I need your support of how can i embed the xml message in a cdata section as below :

<NS1:Envelope xmlns:NS1="">
<NS2:Body xmlns:NS2="">
<NS2:UploadRequest>
<NS2:xml>
<![CDATA[<NS3:registryRecords xmlns:NS3="">
<NS3:add id="1" profileId="xxxx" status="ACTIVE" number="123456789">
<oneSMS phoneNumber="123456789"/>
</NS3:add>
</NS3:registryRecords>]]>
</NS2:xml>
</NS2:UploadRequest>
</NS2:Body>
</NS1:Envelope>

i tried my best and the output as following indicates that cdata has no values:

<NS1:Envelope xmlns:NS1="">
<NS2:Body xmlns:NS2="">
<NS2:UploadRequest>
<NS2:xml>
<![CDATA[]]><NS3:registryRecords xmlns:NS3="">
<NS3:add id="1" profileId="xxxx" status="ACTIVE" number="123456789">
<oneSMS phoneNumber="123456789"/>
</NS3:add>
</NS3:registryRecords>
</NS2:xml>
</NS2:UploadRequest>
</NS2:Body>
</NS1:Envelope>

Any leads would help.

Thanks![/b]
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Aug 14, 2022 10:27 pm    Post subject: Re: IIB How can embed the converted xml message in CData sec Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
Location: LI,NY

MrLight wrote:
Hello Dears ,

I need your support of how can i embed the xml message in a cdata section as below :

Code:
<NS1:Envelope xmlns:NS1="">
   <NS2:Body xmlns:NS2="">
      <NS2:UploadRequest>
         <NS2:xml>
            <![CDATA[<NS3:registryRecords xmlns:NS3="">
               <NS3:add id="1" profileId="xxxx" status="ACTIVE" number="123456789">
                  <oneSMS phoneNumber="123456789"/>
               </NS3:add>
            </NS3:registryRecords>]]>
         </NS2:xml>
      </NS2:UploadRequest>
   </NS2:Body>
</NS1:Envelope>


i tried my best and the output as following indicates that cdata has no values:

Code:
<NS1:Envelope xmlns:NS1="">
   <NS2:Body xmlns:NS2="">
      <NS2:UploadRequest>
         <NS2:xml>
            <![CDATA[]]><NS3:registryRecords xmlns:NS3="">
               <NS3:add id="1" profileId="xxxx" status="ACTIVE" number="123456789">
                  <oneSMS phoneNumber="123456789"/>
               </NS3:add>
            </NS3:registryRecords>
         </NS2:xml>
      </NS2:UploadRequest>
   </NS2:Body>
</NS1:Envelope>


Any leads would help.

Thanks![/b]

Well, Dear; this is most likely due to your coding, and as you did not provide the relevant code snippets we won't be able to help you...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
timber
PostPosted: Mon Aug 15, 2022 1:45 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Please state which product version you are using. Please tell us where you have looked for information. Please post your code.

Without this information it is very difficult to provide help.
Back to top
View user's profile Send private message
MrLight
PostPosted: Mon Aug 15, 2022 5:56 am    Post subject: Re: IIB How can embed the converted xml message in CData sec Reply with quote

Novice

Joined: 04 Aug 2022
Posts: 14

fjb_saper wrote:
MrLight wrote:
Hello Dears ,

I need your support of how can i embed the xml message in a cdata section as below :

Code:
<NS1:Envelope xmlns:NS1="">
   <NS2:Body xmlns:NS2="">
      <NS2:UploadRequest>
         <NS2:xml>
            <![CDATA[<NS3:registryRecords xmlns:NS3="">
               <NS3:add id="1" profileId="xxxx" status="ACTIVE" number="123456789">
                  <oneSMS phoneNumber="123456789"/>
               </NS3:add>
            </NS3:registryRecords>]]>
         </NS2:xml>
      </NS2:UploadRequest>
   </NS2:Body>
</NS1:Envelope>


i tried my best and the output as following indicates that cdata has no values:

Code:
<NS1:Envelope xmlns:NS1="">
   <NS2:Body xmlns:NS2="">
      <NS2:UploadRequest>
         <NS2:xml>
            <![CDATA[]]><NS3:registryRecords xmlns:NS3="">
               <NS3:add id="1" profileId="xxxx" status="ACTIVE" number="123456789">
                  <oneSMS phoneNumber="123456789"/>
               </NS3:add>
            </NS3:registryRecords>
         </NS2:xml>
      </NS2:UploadRequest>
   </NS2:Body>
</NS1:Envelope>


Any leads would help.

Thanks![/b]

Well, Dear; this is most likely due to your coding, and as you did not provide the relevant code snippets we won't be able to help you...




This my coding to create the message after parsing the data from CSV files i will need to send it to specific web service by a soap request node :

CREATE LASTCHILD OF OutputRoot.XMLNSC.soapenv:Envelope.typ:Body.
typ:registryUploadRequest.(XMLNSC.CDataField)typ:xml.ns:record.ns:add;





DECLARE payLoadOut REFERENCE TO OutputRoot.XMLNSC.soapenv:Envelope.typ:Body.
typ:registryUploadRequest.(XMLNSC.CDataField)typ:xml.ns:record.ns:add;



FOR payLoadIn AS InputRoot.DFDL.CSVSchema.record[] DO

SET payLoadOut.(XMLNSC.Attribute)id = '1';
SET payLoadOut.(XMLNSC.Attribute)profileId = 'XXXX';
SET payLoadOut.(XMLNSC.Attribute)cardStatus = 'ACTIVE';
SET payLoadOut.(XMLNSC.Attribute)cardNumber = payLoadIn.number;
SET payLoadOut.oneSMS.(XMLNSC.Attribute)phoneNumber = payLoadIn.phoneNumber;

END FOR;
Back to top
View user's profile Send private message
MrLight
PostPosted: Mon Aug 15, 2022 5:58 am    Post subject: Reply with quote

Novice

Joined: 04 Aug 2022
Posts: 14

timber wrote:
Please state which product version you are using. Please tell us where you have looked for information. Please post your code.

Without this information it is very difficult to provide help.


Hello dear ,

I am using IBM app Connect V11 , my code that will create the xml message after parsing the incoming data above
Back to top
View user's profile Send private message
AH270751
PostPosted: Tue Aug 16, 2022 12:43 am    Post subject: Reply with quote

Newbie

Joined: 03 Jul 2019
Posts: 3

Try Below Code and let me know

SET OutputRoot.XMLNSC.soapenv:Envelope.typ:Body.
typ:UploadRequest.typ:xml.(XML.CDataSection) ='[<NS3:registryRecords xmlns:NS3="">
<NS3:add id="1" profileId="xxxx" status="ACTIVE" number="' ||payLoadIn.number||'">
<oneSMS phoneNumber="' || payLoadIn.phoneNumber|| '"/>
</NS3:add>
</NS3:registryRecords>';

Output:

<NS1:Envelope xmlns:NS1="">
<NS2:Body xmlns:NS2="">
<NS2:UploadRequest>
<NS2:xml>
<![CDATA[[<NS3:registryRecords xmlns:NS3=""><NS3:add id="1" profileId="xxxx" status="ACTIVE" number="4444444"><oneSMS phoneNumber="55555555"/></NS3:add></NS3:registryRecords>]]>
</NS2:xml>
</NS2:UploadRequest>
</NS2:Body>
</NS1:Envelope>
Back to top
View user's profile Send private message
timber
PostPosted: Tue Aug 16, 2022 1:51 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

@AH270751: Your solution has two problems:
1. You cannot use XML.CDataSection with the XMLNSC parser.
2. Your code is hard-coding the content of the CDATA section. But MrLight needs a solution that works with variable input data.

@MrLight: A CDATA section does not contain XML. It contains text. If you want to embed well-formed XML inside a CDATA section then you need to
- Create the XML tree for the embedded XML.
- Write the XML tree as a text string (using ASBITSTREAM) and save it in a CHARACTER variable.
- Construct the SOAP tree
- Assign the text string to the CDataSection and set the field type to XMLNSC.CDataSection

Let us know if you need help with that.
Back to top
View user's profile Send private message
MrLight
PostPosted: Thu Aug 18, 2022 5:19 am    Post subject: Reply with quote

Novice

Joined: 04 Aug 2022
Posts: 14

@AH270751: thanks dear your solution is worked for me as the output you posted , but this is static [hard coded one ] , i need a dynamic solution that can embed the converted xml to CDATA , as my solution that i posted earlier has no value returned to this tag

Thanks in advance
Back to top
View user's profile Send private message
MrLight
PostPosted: Thu Aug 18, 2022 5:30 am    Post subject: Reply with quote

Novice

Joined: 04 Aug 2022
Posts: 14

@timber , yes dear i need a help.
after a lot of search most of this this result as you said above and i tried with this solution but still the whole conversion failed and just the same data copied to the output same

find the following code used:

CREATE LASTCHILD OF OutputRoot.XMLNSC.soapenv:Envelope.typ:Body.
typ:typ:registryUploadRequest.(XMLNSC.CDataField)typ:xml.ns:record.ns:add;

DECLARE wholeMsgBlob BLOB ASBITSTREAM(OutputRoot.XMLNSC, OutputRoot.Properties.Encoding,OutputRoot.Properties.CodedCharSetId);

DECLARE wholeMsgChar CHAR CAST(wholeMsgBlob AS CHAR CCSID OutputRoot.Properties.CodedCharSetId);

DECLARE payLoadOut CHARACTER OutputRoot.XMLNSC.soapenv:Envelope.typ:Body.
typ:typ:registryUploadRequest.(XMLNSC.CDataField)typ:xml.ns:record.ns:add = wholeMsgChar;



FOR payLoadIn AS InputRoot.DFDL.CSVSchema.record[] DO

SET payLoadOut.(XMLNSC.Attribute)id = '1';
SET payLoadOut.(XMLNSC.Attribute)profileId = 'XXXX';
SET payLoadOut.(XMLNSC.Attribute)cardStatus = 'ACTIVE';
SET payLoadOut.(XMLNSC.Attribute)cardNumber = payLoadIn.number;
SET payLoadOut.oneSMS.(XMLNSC.Attribute)phoneNumber = payLoadIn.phoneNumber;

END FOR;


The following Exception thrown in the log :
RecoverableException = (
(0x03000000:NameValue):File = 'C:\ci\product-build\WMB\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 785 (INTEGER)
(0x03000000:NameValue):Function = 'SqlStatementGroup::execute' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2488 (INTEGER)
(0x03000000:NameValue):Text = 'Error detected, rethrowing' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'MyAsc.MyFlow_trans.Main' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '19.3' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'DECLARE wholeMsgChar CHARACTER CAST(wholeMsgBlob AS CHARACTER CCSID OutputRoot.Properties.CodedCharSetId);' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = 'C:\ci\product-build\WMB\src\DataFlowEngine\ImbRdl\ImbRdlTypeCast.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 173 (INTEGER)
(0x03000000:NameValue):Function = 'SqlTypeCast::evaluate' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2906 (INTEGER)
(0x03000000:NameValue):Text = '' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'MyAsc.MyFlow_trans.Main' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '19.29' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'UNKNOWN' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'CCSID' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'CAST' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'INTEGER' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'NULL' (CHARACTER)
)
)
Back to top
View user's profile Send private message
MrLight
PostPosted: Sat Aug 27, 2022 3:47 am    Post subject: Reply with quote

Novice

Joined: 04 Aug 2022
Posts: 14

timber wrote:
@AH270751: Your solution has two problems:
1. You cannot use XML.CDataSection with the XMLNSC parser.
2. Your code is hard-coding the content of the CDATA section. But MrLight needs a solution that works with variable input data.

@MrLight: A CDATA section does not contain XML. It contains text. If you want to embed well-formed XML inside a CDATA section then you need to
- Create the XML tree for the embedded XML.
- Write the XML tree as a text string (using ASBITSTREAM) and save it in a CHARACTER variable.
- Construct the SOAP tree
- Assign the text string to the CDataSection and set the field type to XMLNSC.CDataSection

Let us know if you need help with that.


Do you have an update for the above that indicate what i did ?
Back to top
View user's profile Send private message
timber
PostPosted: Tue Aug 30, 2022 1:32 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Your code is not doing the 4 steps that I suggested. Not even close.
My advice is the same as before - if you follow those steps carefully, accurately, in the order that I specified then you will probably get it working.
Back to top
View user's profile Send private message
MrLight
PostPosted: Sat Sep 03, 2022 4:34 am    Post subject: Reply with quote

Novice

Joined: 04 Aug 2022
Posts: 14

timber wrote:
Your code is not doing the 4 steps that I suggested. Not even close.
My advice is the same as before - if you follow those steps carefully, accurately, in the order that I specified then you will probably get it working.


@timber ,
Can you simulate and place a simple code with the 4 steps that you said earlier ?
Back to top
View user's profile Send private message
timber
PostPosted: Mon Sep 05, 2022 3:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

I don't have time to write the ESQL for you.

Can you explain what this line of code does?
Code:
DECLARE payLoadOut CHARACTER OutputRoot.XMLNSC.soapenv:Envelope.typ:Body.typ:typ:registryUploadRequest.(XMLNSC.CDataField)typ:xml.ns:record.ns:add = wholeMsgChar;
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB How can embed the converted xml message in CData section
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.