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 » not able to create Attributes in ESQL

Post new topic  Reply to topic
 not able to create Attributes in ESQL « View previous topic :: View next topic » 
Author Message
JawedImran
PostPosted: Tue Dec 24, 2013 11:00 am    Post subject: not able to create Attributes in ESQL Reply with quote

Newbie

Joined: 15 Aug 2013
Posts: 5

Hi All,

I am new in message broker, getting problem while creating attributes in xml node using MB7.

Element Value is getting override and attributes are not creating as expected.

Input:
Code:

<ns1:Application>
    <ns1:Attachments>
        <ns1:DocumentId>55</ns1:DocumentId>
        <ns1:DocumentPages>1</ns1:DocumentPages>
        <ns1:DocumentType>PDF</ns1:DocumentType>
        <ns1:TaxonomyDocType>12</ns1:TaxonomyDocType>
        <ns1:Attachment>abcd</ns1:Attachment>
    </ns1:Attachments>
   <ns1:Attachments>
        <ns1:DocumentId>56</ns1:DocumentId>
        <ns1:DocumentPages>2</ns1:DocumentPages>
        <ns1:DocumentType>PDF</ns1:DocumentType>
        <ns1:TaxonomyDocType>13</ns1:TaxonomyDocType>
        <ns1:Attachment>abcd</ns1:Attachment>
    </ns1:Attachments>
</ns1:Application>


DECLARE application REFERENCE TO InputRoot.SOAP.Body.nsCntt:Application;

CREATE FIELD OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;
DECLARE outApp REFERENCE TO OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;

FOR applicationAttachments AS application.ns1:Attachments[] DO
   DECLARE outAttachment REFERENCE TO OutputRoot;
   CREATE LASTCHILD OF outApp AS outAttachment NAMESPACE ns1 NAME 'Attachments';
   
   SET outAttachment = applicationAttachments.ns1:DocumentId; -- creating Attachments node value
   SET outAttachment.(XMLNSC.Attribute)DocumentPages = applicationAttachments.nsCntt:DocumentPages; --adding attribute
   SET outAttachment.(XMLNSC.Attribute)DocumentType = applicationAttachments.nsCntt:DocumentType; --adding attribute
   SET outAttachment.(XMLNSC.Attribute)TaxonomyDocType = applicationAttachments.nsCntt:DocumentType; --adding attribute

END FOR;

OutPut:
<ns1:Application>
<ns1:Attachments DocumentPages="1" DocumentType="PDF" TaxonomyDocType="12" >55</ns1:Attachments>
<ns1:Attachments DocumentPages="2" DocumentType="PDF" TaxonomyDocType="13" >56</ns1:Attachments>
</ns1:Application>


Last edited by JawedImran on Tue Dec 24, 2013 12:18 pm; edited 2 times in total
Back to top
View user's profile Send private message
JawedImran
PostPosted: Tue Dec 24, 2013 11:05 am    Post subject: Reply with quote

Newbie

Joined: 15 Aug 2013
Posts: 5

Even I tried with below code but same issue.

DECLARE application REFERENCE TO InputRoot.SOAP.Body.nsCntt:Application;
Code:

CREATE FIELD OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;
DECLARE outApp REFERENCE TO OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;
DECLARE j INTEGER 1;
FOR applicationAttachments AS application.ns1:Attachments[] DO
      
   SET outApp.ns1:Attachments[j] = applicationAttachments.ns1:DocumentId; -- creating Attachments node value
   SET outApp.ns1:Attachments[j].(XMLNSC.Attribute)DocumentPages = applicationAttachments.nsCntt:DocumentPages; --adding attribute
   SET outApp.ns1:Attachments[j].(XMLNSC.Attribute)DocumentType = applicationAttachments.nsCntt:DocumentType; --adding attribute
   SET outApp.ns1:Attachments[j].(XMLNSC.Attribute)TaxonomyDocType = applicationAttachments.nsCntt:DocumentType; --adding attribute
   SET j = j + 1;
END FOR;
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 25, 2013 1:04 am    Post subject: Re: not able to create Attributes in ESQL Reply with quote

Grand High Poobah

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

JawedImran wrote:
Code:

DECLARE application REFERENCE TO InputRoot.SOAP.Body.nsCntt:Application;

CREATE FIELD OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;
DECLARE outApp REFERENCE TO OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;

FOR applicationAttachments AS application.ns1:Attachments[] DO
   DECLARE outAttachment REFERENCE TO OutputRoot;
   CREATE LASTCHILD OF outApp AS outAttachment NAMESPACE ns1 NAME 'Attachments';
   
   SET outAttachment = applicationAttachments.ns1:DocumentId; -- creating Attachments node value
   SET outAttachment.(XMLNSC.Attribute)DocumentPages = applicationAttachments.nsCntt:DocumentPages; --adding attribute
   SET outAttachment.(XMLNSC.Attribute)DocumentType = applicationAttachments.nsCntt:DocumentType; --adding attribute
   SET outAttachment.(XMLNSC.Attribute)TaxonomyDocType = applicationAttachments.nsCntt:DocumentType; --adding attribute

END FOR;

OutPut:
<ns1:Application>
<ns1:Attachments DocumentPages="1" DocumentType="PDF" TaxonomyDocType="12" >55</ns1:Attachments>
<ns1:Attachments DocumentPages="2" DocumentType="PDF" TaxonomyDocType="13" >56</ns1:Attachments>
</ns1:Application>


Your code ; DECLARE outAttachment REFERENCE TO OutputRoot;...
I'm sure you meant to say something like
Code:
CREATE LAST CHILD OF outapp as outAttachment Namespace... Name 'Attachments';


That's not the only thing... did you check the lastmove(outapp) after assigning outapp?
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
JawedImran
PostPosted: Wed Dec 25, 2013 11:50 pm    Post subject: Reply with quote

Newbie

Joined: 15 Aug 2013
Posts: 5

Hi Saper,

Thanks for Quick response.

Yeah I tried with LastMove also.

Even I tried with Simple FOR loop logic but same issue. attribute are not getting created.
Code:

DECLARE application REFERENCE TO InputRoot.SOAP.Body.nsCntt:Application;

CREATE FIELD OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;
DECLARE outApp REFERENCE TO OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns1:Application;
DECLARE j INTEGER 1;
FOR applicationAttachments AS application.ns1:Attachments[] DO

   SET outApp.ns1:Attachments[j] = applicationAttachments.ns1:DocumentId; -- creating Attachments node value
   SET outApp.ns1:Attachments[j].(XMLNSC.Attribute)DocumentPages = applicationAttachments.nsCntt:DocumentPages; --adding attribute
   SET outApp.ns1:Attachments[j].(XMLNSC.Attribute)DocumentType = applicationAttachments.nsCntt:DocumentType; --adding attribute
   SET outApp.ns1:Attachments[j].(XMLNSC.Attribute)TaxonomyDocType = applicationAttachments.nsCntt:DocumentType; --adding attribute
   SET j = j + 1;
END FOR;
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Dec 26, 2013 3:08 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.

Please use [ C O D E ] tags around your code

What does a usertrace show when executing the ESQL you posted?
You say they are not being created. Ok, what is or isn't being created?
_________________
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
fjb_saper
PostPosted: Thu Dec 26, 2013 6:58 am    Post subject: Reply with quote

Grand High Poobah

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

And sorry, but your code does not show you checking for lastmove(cursor) after defining a cursor...
You do know that you have to do that right?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Fri Dec 27, 2013 9:03 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I can help you with this, but please do the following:
- add [ C O D E ] tags around your XML and ESQL snippets. It is very hard to read them otherwise. There is an [ edit ] button that you can use to do that ( when you have logged in ).
- provide an example of the output that you want, and the output that your flow is producing. Then we will be able to see what is wrong.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 27, 2013 10:38 am    Post subject: Reply with quote

Grand High Poobah

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

Wrapped the code with tags...
Sorry to say but your code does exactly what you are telling it to do....

Have you tried changing following line
Code:
SET outAttachment = applicationAttachments.ns1:DocumentId; -- creating Attachments node value


to
Code:
SET outAttachment.(XMLNSC.Attribute)DocumentId = applicationAttachments.ns1:DocumentId; -- creating Attachments node value

Maybe that would be closer to what you're looking for...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » not able to create Attributes in ESQL
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.