Author |
Message
|
touchofcrypticthunder |
Posted: Sat Aug 11, 2012 7:12 am Post subject: using namespace definitions from library across ESQL schema |
|
|
Apprentice
Joined: 08 Jul 2009 Posts: 30
|
I am working on Message Broker V7. I am facing an issue to access namespace definitions from common library across ESQL schema.
Let us assume, we have all the namespace definitions in Namespace.esql defined under schema 'common'. I would like to access these namespace definitions in message flow ESQL modules defined under different schemas say for ex, default schema. I tried using PATH clause which did not help.
I would like to know if there is a way to access namespace definitions across schema OR if this is not supported in Message Broker at all. Your help is greatly appreciated. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Aug 11, 2012 8:43 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
It should be possible in a kind of roundabout way.
Store all the namespace declarations as CHAR with a nickname
Have a simple function that returns the value when called for the nickname
Then in your code
Code: |
DECLARE myns CHARACTER CALL getns('myns');
DECLARE nsmyns NAMESPACE myns; |
This is the same kind of workaround I used with the ns declared in a UDP.
Hope this helps some  _________________ MQ & Broker admin |
|
Back to top |
|
 |
touchofcrypticthunder |
Posted: Sat Aug 11, 2012 10:38 am Post subject: |
|
|
Apprentice
Joined: 08 Jul 2009 Posts: 30
|
Thanks for the workaround solution. Below is the solution which I have implemented.
Following is the code to declare and return namespace as character:
BROKER SCHEMA common
CREATE FUNCTION getNamespace(IN inVal CHARACTER) RETURNS CHARACTER
BEGIN
DECLARE namespaceStorage ROW;
SET namespaceStorage.List[] = LIST { ROW('nsSoapEnv' AS nsName, 'http://schemas.xmlsoap.org/soap/envelope/' AS nsValue),
ROW('nsWorkOrd' AS nsName, 'http://tbccorp.com/Services/WorkOrderMgt/v1/' AS nsValue)
};
RETURN (THE(SELECT ITEM NS.nsValue FROM namespaceStorage.List[] AS NS WHERE NS.nsName = inVal));
END;
Following is the code to get namespace as CHARACTER and use for constructing output message:
DECLARE nsSoapChar CHARACTER common.getNamespace('nsSoapEnv');
DECLARE nsWorkOrdChar CHARACTER common.getNamespace('nsWorkOrd');
DECLARE nsSoap NAMESPACE nsSoapChar;
DECLARE nsWorkOrd NAMESPACE nsWorkOrdChar;
SET OutputRoot.XMLNSC.nsSoap:Envelope.nsSoap:Body.nsWorkOrd:Employee.Name = 'x'; |
|
Back to top |
|
 |
touchofcrypticthunder |
Posted: Sat Aug 11, 2012 10:42 am Post subject: |
|
|
Apprentice
Joined: 08 Jul 2009 Posts: 30
|
Please suggest if your solution is different from the one mentioned below. |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Aug 11, 2012 11:27 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'd think yo could refer to the namespace directly using
Code: |
common.nsSoapCharacter |
.
i.e. something like
Code: |
SET OutputRoot.XMLNSC.{common.nsSoap}:Envelope.{common.nsSoap}:Body.{common.nsWorkOrd}:Employee.Name = 'x'; |
but I've not run experiments. |
|
Back to top |
|
 |
touchofcrypticthunder |
Posted: Sat Aug 11, 2012 7:44 pm Post subject: |
|
|
Apprentice
Joined: 08 Jul 2009 Posts: 30
|
I have tried this option before. It does not work and it throws exception during deployment saying the reference to the namespace is not defined. |
|
Back to top |
|
 |
|