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 » [HELP] NAMESPACE PROBLEM

Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next
 [HELP] NAMESPACE PROBLEM « View previous topic :: View next topic » 
Author Message
fjb_saper
PostPosted: Tue Dec 22, 2015 12:12 am    Post subject: Reply with quote

Grand High Poobah

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

anon_kb wrote:
Hi FJB,

Sorry but I still dont get about this If no namespace declaration is done the namespace will follow an autonumbering scheme

Declare it in esql
1. DECLARE namespace1 NAMESPACE 'http://www.openapplications.org/oagis/9';
DECLARE namespace2 NAMESPACE 'http://www.gic.site.com/oagis/9/site/1';
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';

2. Assign
SET shipmentHeaderOutRef.namespace1:Attachment = tstSQSData;


so if you did the 2 above things and did not use on top of it the XMLNSC.NameSpaceDecl your XML would look like this:
Code:
<.....>
 <NSX:Attachment xmlns:NSX="http://www.openapplicatiions.org/oagis/9'>contentof tstSQSData</NSX:Attachment>


Here X in NSX is the nth occurrence of a namespace.
The autonumbering scheme goes like NS1, NS2, NS3,...NSX...

The use of the XMLNSC.NameSpaceDecl allows you to control the appearance i.e. openapp:Attachement instead of NSX:Attachment and if repeated, not to declare the same namespace with different prefixes, or declare a default namespace (again for document namespace appearance, not assignment).

Hope this clears it up.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
anon_kb
PostPosted: Tue Dec 22, 2015 12:24 am    Post subject: Reply with quote

Acolyte

Joined: 13 Nov 2014
Posts: 74

Quote:
so if you did the 2 above things and did not use on top of it the XMLNSC.NameSpaceDecl your XML would look like this:
Code:
<.....>
 <NSX:Attachment xmlns:NSX="http://www.openapplicatiions.org/oagis/9'>contentof tstSQSData</NSX:Attachment>


The use of the XMLNSC.NameSpaceDecl allows you to control the appearance i.e. openapp:Attachement instead of NSX:Attachment and if repeated, not to declare the same namespace with different prefixes, or declare a default namespace (again for document namespace appearance, not assignment).

Hope this clears it up.


Yes youre right. but for my expected output. it must be like this
Code:
<.....>
 <Attachment xmlns ="http://www.openapplicatiions.org/oagis/9'>contentof tstSQSData</Attachment>


It really baffled me up since as what I have said as I do the mapping on other elements theres no problem on it except on this:

Quote:
<SQSData>
<LOT>
<LotNumber>28501</LotNumber>
<DeliveryNumber>MANUAL DISPATCH</DeliveryNumber>
<ShipTo>SHIP</ShipTo>
<CODNIF> </CODNIF>
<CODNIP> </CODNIP>
<FECFAB>2015-10-12 00:00:00</FECFAB>
</LOT>
<LOT>
<LotNumber>28502</LotNumber>
<DeliveryNumber>MANUAL DISPATCH</DeliveryNumber>
<ShipTo>SHIP</ShipTo>
<CODNIF> </CODNIF>
<CODNIP> </CODNIP>
<FECFAB>2015-10-12 00:00:00</FECFAB>
</LOT>
</SQSData>


for example if I map this part of input xml :
SET shipmentHeaderOutRef.namespace2:DocumentID.namespace1:ID = bsmHeaderInRef.DispatchingMode;

also if I want to get the Lot Number on SQSData.
SET shipmentHeaderOutRef.namespace1:Attachment = tstSQSData.LOT.LotNumber; It can map successfully without any problem on namespace SET shipmentHeaderOutRef.namespace1:Attachment = tstSQSData; but if i do this this gives me the problem.

Sorry for the questions, I understand your point but this situations baffle me.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Dec 22, 2015 12:59 am    Post subject: Reply with quote

Grand High Poobah

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

The thing is that you require in your final document to have a default namespace for SQSData...
So you assign the SQSData (which at that point has not namespace assigned) to the Attachment.
However setting the appearance of a default namespace (XMLNSC.NameSpaceDecl) does not assign a default namespace...
You need to go recursively through your SQSData and assign the namespace:
Code:
SET ref NAMESPACE = namespace1;
moving your ref to each and everyone of the sub-elements of Attachment....
Hope this is now clear...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
anon_kb
PostPosted: Tue Dec 22, 2015 2:42 am    Post subject: Reply with quote

Acolyte

Joined: 13 Nov 2014
Posts: 74

fjb_saper wrote:
The thing is that you require in your final document to have a default namespace for SQSData...
So you assign the SQSData (which at that point has not namespace assigned) to the Attachment.
However setting the appearance of a default namespace (XMLNSC.NameSpaceDecl) does not assign a default namespace...
You need to go recursively through your SQSData and assign the namespace:
Code:
SET ref NAMESPACE = namespace1;
moving your ref to each and everyone of the sub-elements of Attachment....
Hope this is now clear...



So i'll be using the MOVE statement for this? anyway thanks for your advice fjb
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Dec 22, 2015 7:25 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You don't need a MOVE statement if you use a FOR loop.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
anon_kb
PostPosted: Thu Jan 14, 2016 4:49 am    Post subject: Reply with quote

Acolyte

Joined: 13 Nov 2014
Posts: 74

fjb_saper wrote:
The thing is that you require in your final document to have a default namespace for SQSData...
So you assign the SQSData (which at that point has not namespace assigned) to the Attachment.
However setting the appearance of a default namespace (XMLNSC.NameSpaceDecl) does not assign a default namespace...
You need to go recursively through your SQSData and assign the namespace:
Code:
SET ref NAMESPACE = namespace1;
moving your ref to each and everyone of the sub-elements of Attachment....
Hope this is now clear...


Hi again FJB,

I understand your point but I dont know how to implement it.. Sorry..

Anyway I tried to do this:
FOR input as InputRoot.XMLNSC.BSMERPShipmentConfirm.SQSData.*[] DO
SET shipmentHeaderOutRef.namespace1:Attachment = input
END FOR;
and stll same error..
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Jan 14, 2016 5:21 am    Post subject: Reply with quote

Grand High Poobah

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

You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en

Code:
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
  IF FIELDTYPE(output)= XMLNSC.ElementType THEN
     SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
  END IF;
END FOR;

Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
anon_kb
PostPosted: Mon Jan 18, 2016 1:15 am    Post subject: Reply with quote

Acolyte

Joined: 13 Nov 2014
Posts: 74

fjb_saper wrote:
You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en

Code:
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
  IF FIELDTYPE(output)= XMLNSC.ElementType THEN
     SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
  END IF;
END FOR;

Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...

Have fun


Hi FJB,

What do you mean by that XMLNSC.ElementType? ElementType does not exist under XMLNSC. And also I look at the link and the input has been based for looping not the output. Sorry for this question.

Thanks
Back to top
View user's profile Send private message
maurito
PostPosted: Mon Jan 18, 2016 1:59 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

anon_kb wrote:
fjb_saper wrote:
You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en

Code:
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
  IF FIELDTYPE(output)= XMLNSC.ElementType THEN
     SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
  END IF;
END FOR;

Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...

Have fun


Hi FJB,

What do you mean by that XMLNSC.ElementType? ElementType does not exist under XMLNSC. And also I look at the link and the input has been based for looping not the output. Sorry for this question.

Thanks

I guess it means that you need to do some investigation and get it to work. For that reason, FJB is saying
Quote:
Or something like that.
Back to top
View user's profile Send private message
anon_kb
PostPosted: Mon Jan 18, 2016 4:01 am    Post subject: Reply with quote

Acolyte

Joined: 13 Nov 2014
Posts: 74

maurito wrote:
anon_kb wrote:
fjb_saper wrote:
You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en

Code:
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
  IF FIELDTYPE(output)= XMLNSC.ElementType THEN
     SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
  END IF;
END FOR;

Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...

Have fun


Hi FJB,

What do you mean by that XMLNSC.ElementType? ElementType does not exist under XMLNSC. And also I look at the link and the input has been based for looping not the output. Sorry for this question.

Thanks

I guess it means that you need to do some investigation and get it to work. For that reason, FJB is saying
Quote:
Or something like that.


Understand a bit. But kinda hard..aarghh

Code:

SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
            SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
            SET OutputRoot.XMLNSC.sn1:AcknowledgeShipment = '';
            SET OutputRoot.XMLNSC.sn1:AcknowledgeShipment.(XMLNSC.NamespaceDecl)xmlns = sn1;
            --SET OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:tEST = Environment.Variables.sqs;
            SET OutputRoot.MQMD=InputRoot.MQMD;
            
            DECLARE i INTEGER 1;
            FOR output as OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[] DO
              IF FIELDTYPE(output)= XMLNSC.Element THEN      
                 SET output NAMESPACE = 'http://www.openapplications.org/oagis/9';
              END IF;
              CREATE LASTCHILD OF OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[i]
                                VALUE bsmSQSData.LOT || '\' || CAST(i AS CHAR);
              SET i = i + 1;
            END FOR;


Tried this but no value for bsmSQSData.LOT appears on the output.
Back to top
View user's profile Send private message
timber
PostPosted: Mon Jan 18, 2016 4:35 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

Your coding style does not inspire confidence:
- Indentation is not consistent
- You are copying the MQMD header halfway through the code that constructs the output message body

I suggest that you step through the code in the debugger. Or take a user trace and look at what is happening. If you cannot do either of those, tell your boss that you don't have the tools to do the job.
Back to top
View user's profile Send private message
anon_kb
PostPosted: Mon Jan 18, 2016 7:00 pm    Post subject: Reply with quote

Acolyte

Joined: 13 Nov 2014
Posts: 74

timber wrote:
Your coding style does not inspire confidence:
- Indentation is not consistent
- You are copying the MQMD header halfway through the code that constructs the output message body

I suggest that you step through the code in the debugger. Or take a user trace and look at what is happening. If you cannot do either of those, tell your boss that you don't have the tools to do the job.


Sorry for the coding style. Its just a test code that I've done. Dont have any debugger and cant even trace on my environment. Anyway thanks for your reply.

@FJB
Tried this code. And still no output, but error has been removed
Code:
DECLARE i INTEGER 1;
            FOR output as OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[] DO
              IF FIELDTYPE(output)= XMLNSC.Element THEN      
                 SET output NAMESPACE = 'http://www.openapplications.org/oagis/9';
                 SET output = bsmSQSData.*[i];               
              END IF;
              SET i = i + 1;
            END FOR;
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 19, 2016 5:08 am    Post subject: Reply with quote

Grand High Poobah

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

Why are you trying to do 5 things at once and each one undoing the previous one?

First assign your values. Then walk the tree assigning the namespace.
Assigning a value will undo the namespace assignment.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
anon_kb
PostPosted: Tue Jan 19, 2016 9:45 pm    Post subject: Reply with quote

Acolyte

Joined: 13 Nov 2014
Posts: 74

fjb_saper wrote:
Why are you trying to do 5 things at once and each one undoing the previous one?

First assign your values. Then walk the tree assigning the namespace.
Assigning a value will undo the namespace assignment.

Have fun


Like this?
Code:
CREATE LASTCHILD OF OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[i]
                                VALUE bsmSQSData.LOT || '\' || CAST(i AS CHAR);


Ohw I'm really sorry, its really vague on me now. Anyway thanks for your suggestion, I'm gonna try and try but I think I will be lacking out of time maybe I'll just reconstruct it manually on the code and I will just solve this issue in my free time..
Back to top
View user's profile Send private message
maurito
PostPosted: Wed Jan 20, 2016 12:40 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

you can assign the namespace AND the value all at the same time. Look at the CREATE statement, it has NAMESPACE , NAME and VALUE clauses, amongst other things.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next Page 2 of 3

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » [HELP] NAMESPACE PROBLEM
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.