Author |
Message
|
Prithvi |
Posted: Wed Aug 31, 2005 5:44 am Post subject: Broker assigning default namespace |
|
|
 Apprentice
Joined: 20 Dec 2004 Posts: 34
|
Hi
i am using the following code to create a XMLNS message.
DECLARE works NAMESPACE 'http://www.works:electrabel.works:be/schemas/works';
DECLARE xsi NAMESPACE 'http://www.works:w3.works:org/2001/XMLSchema-instance';
CREATE FIELD OutputRoot.XMLNS.HUBXML_V3.works:Works;
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.(XML.NamespaceDecl)xmlns:works = 'http://www.works:electrabel.works:be/schemas/works';
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.(XML.NamespaceDecl)xmlns:xsi = 'http://www.works:electrabel.works:be/schemas/works';
CREATE FIELD OutputRoot.XMLNS.HUBXML_V3.works:Works.works:Header;
CREATE FIELD OutputRoot.XMLNS.HUBXML_V3.works:Works.works:Header.works:From;
CREATE FIELD OutputRoot.XMLNS.HUBXML_V3.works:Works.works:Header.works:To;
CREATE FIELD OutputRoot.XMLNS.HUBXML_V3.works:Works.works:Header.works:TimeStamp;
.
.
.
The output i get is :
<HUBXML_V3>
<NS1:Works xmlns:NS1="http://www.works:electrabel.works:be/schemas/works">
<NS1:Header>
<NS1:From>Net Mgmt Works</NS1:From>
<NS1:To>5414488005009</NS1:To>
<NS1:TimeStamp>20050831152647741</NS1:TimeStamp>
</NS1:Header>
<NS1:General>
.
.
I wanted to get the string"works" instead of NS1 as the namespace.
I searched on this site and found the following link:
http://www.mqseries.net/phpBB2/viewtopic.php?t=14842&highlight=ns1
But these suggestions do not seem to have the desired effect.I still get the default namespace i.e. NS1.
Has anyone else encoutered and solved this problem???
Any help would be appreciated
i am using WBI MB V5, Fix pack 5
regards _________________ Prithvi |
|
Back to top |
|
 |
TonyD |
Posted: Wed Aug 31, 2005 3:16 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
This ESQL:
Code: |
DECLARE works NAMESPACE 'http://www.works:electrabel.works:be/schemas/works';
DECLARE xsi NAMESPACE 'http://www.works:w3.works:org/2001/XMLSchema-instance';
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.(XML.NamespaceDecl)xmlns:works = 'http://www.works:electrabel.works:be/schemas/works';
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.(XML.NamespaceDecl)xmlns:xsi = 'http://www.works:w3.works:org/2001/XMLSchema-instance';
CREATE FIELD OutputRoot.XMLNS.HUBXML_V3.works:Works;
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.works:Header.works:From = 'Net Mgmt Works';
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.works:Header.works:To = '5414488005009';
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.works:Header.works:TimeStamp = CURRENT_TIMESTAMP;
|
produces this output:
Code: |
<HUBXML_V3>
<works:Works xmlns:works="http://www.works:electrabel.works:be/schemas/works" xmlns:xsi="http://www.works:w3.works:org/2001/XMLSchema-instance">
<works:Header>
<works:From>Net Mgmt Works</works:From>
<works:To>5414488005009</works:To>
<works:TimeStamp>2005-09-01 09:05:19.314</works:TimeStamp>
</works:Header>
</works:Works>
</HUBXML_V3>
|
Is that what you want? |
|
Back to top |
|
 |
Prithvi |
Posted: Thu Sep 01, 2005 12:52 am Post subject: |
|
|
 Apprentice
Joined: 20 Dec 2004 Posts: 34
|
Hi Tony,
The difference between the code you suggested and the code that i am using is that you are using a CREATE FIELD statement for the 'Works' field after assigning a name space to it. I have done it the other way around i.e. first created the field and then assigned a namespace to it.
I have tried your suggestion, but it produces the same output as mine.
I have a feeling that the Broker is not able to pick up the nale of the namespace i have assigned, and is, as a result, assiging a default namespace.
I have condidered converting the entire data to BLOB format and replace the string 'NS1' with 'works'. Bu this is a crude way to do this.
Surely i am missing something that the broker expects!!! Is there anyone who has dealt successfully with a similar problem before ??
Regards _________________ Prithvi |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Sep 01, 2005 1:01 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Prithvi,
You should be using CREATE FIELD to create the segment fields in the IDoc(or whatever is ur output)...
Then u can make use of the SET for the fields under that segment....
If this does not work, then go to the properties page of the message set and find Namespace Settings....
In that add ur namespace along with the prefic "works"...ur output should then work....
Let us know if it does.
Regards. |
|
Back to top |
|
 |
Prithvi |
Posted: Thu Sep 01, 2005 1:25 am Post subject: |
|
|
 Apprentice
Joined: 20 Dec 2004 Posts: 34
|
Hi Elvis,
I am sorry i neglected to clarify this earlier, but i am not using a message set for the output. We are using a java program to perform all the validations on the output messages.
I am creating the skeleton structure for the output, and then i am setting the fields.
I searched on this site and found a quote from on of the members,
http://www.mqseries.net/phpBB2/viewtopic.php?t=14842&highlight=ns1
Quote: |
JLRowe:I think with the XMLNS parser, the namespace prefix will come out as NS1.
e.g.
<NS1:interface xmlns:NS1="interface/message/1.0.0.1">
...
The only way to get a specific prefix is to use MRM.
|
I still think there should be a way force the broker to use the namespace i have assigned instead of it assigning a default one. _________________ Prithvi |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Sep 01, 2005 2:19 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Well then i guess u should try to make use of MRM and see if the namespace "works" works
Is it much simpler to do the validation using a message set or using a Java application ??? |
|
Back to top |
|
 |
Prithvi |
Posted: Thu Sep 01, 2005 2:30 am Post subject: |
|
|
 Apprentice
Joined: 20 Dec 2004 Posts: 34
|
thanks for the tongue in cheek reply
But the fact is that being a lowly developer, i donot have any real say in the design issues. The powers that be have decided to use a single java application to validate all the different types of messages, instead of building a different message set for every individual type of message.
Must be something to do with performance issues...donno exactly though
Sooo.... one has to play with the cards one is dealt with  _________________ Prithvi |
|
Back to top |
|
 |
TonyD |
Posted: Thu Sep 01, 2005 3:34 am Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Prithvi,
I deliberately modified your incorrect code in order to produce the result that I thought you sought; this included repositioning and correcting the declarations, and also removing unnecessary 'CREATE FIELD' statements.
The result shown in my post was produced by deploying and executing my ESQL through my broker and was the message that was actually written to the queue. If you did not get the same result the fault is yours, not mine.
You might start your debugging by looking at the following declarations to see if you can detect a potential conflict:
Code: |
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.(XML.NamespaceDecl)xmlns:works = 'http://www.works:electrabel.works:be/schemas/works';
SET OutputRoot.XMLNS.HUBXML_V3.works:Works.(XML.NamespaceDecl)xmlns:xsi = 'http://www.works:electrabel.works:be/schemas/works';
|
Finally, if you want to make comments like this:
Quote: |
Is there anyone who has dealt successfully with a similar problem before ??
|
:after rejecting constructive advice from several posters I suggest that you sit down and work through the manuals like the rest of us did. |
|
Back to top |
|
 |
|