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 » Namespaces in children elements

Post new topic  Reply to topic
 Namespaces in children elements « View previous topic :: View next topic » 
Author Message
pottas
PostPosted: Tue Jul 15, 2008 3:28 am    Post subject: Namespaces in children elements Reply with quote

Disciple

Joined: 27 Oct 2005
Posts: 185
Location: South Africa

I run WMB 6.1
I have the following scenario:
I accept a Soap message as input into my flow (Wsdl version1);
I send the Wsdl through a compute node to change the Wsdl version as I need a different version to do a call to a 'Validation Engine'.
The two versions of the Wsdl is exactly the same (same operations, same elements) - the only difference is the namespace.

If I put the following message through the compute node, it changes the Wsdl version and namespace, no problem:
Input:
Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation">
   <soapenv:Header/>
   <soapenv:Body>
      <cus:AcctChgRq>
         <cus:CompanyNo>111</cus:CompanyNo>
         <cus:ProductCd></cus:ProductCd>
         <cus:AcctNo></cus:AcctNo>
         <cus:NewAcctStatus></cus:NewAcctStatus>
         <cus:NewCloseDate></cus:NewCloseDate>
         <cus:NewPriOfficerCd></cus:NewPriOfficerCd>
         <cus:NewSecOfficerCd></cus:NewSecOfficerCd>
         <cus:NewEmployeeInd>aaa</cus:NewEmployeeInd>
         <cus:NewNameLineNo></cus:NewNameLineNo>
         <cus:NewAffinity></cus:NewAffinity>
         <cus:NewLanguageCd></cus:NewLanguageCd>
         <cus:NewReasonCd></cus:NewReasonCd>
      </cus:AcctChgRq>
   </soapenv:Body>
</soapenv:Envelope>


Output:
Code:
<NS1:AcctChgRq xmlns:NS1="http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer">
 <CompanyNo>111</CompanyNo>
 <ProductCd/>
 <AcctNo/>
 <NewAcctStatus/>
 <NewCloseDate/>
 <NewPriOfficerCd/>
 <NewSecOfficerCd/>
 <NewEmployeeInd>aaa</NewEmployeeInd>
 <NewNameLineNo/>
 <NewAffinity/>
 <NewLanguageCd/>
 <NewReasonCd/>
</NS1:AcctChgRq>


...but if I have a input message with embedded elements it seems like it takes the namespaces of the input message and uses it for the output of the embedded elements:

Input:
Code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation">
   <soapenv:Header/>
   <soapenv:Body>
      <cus:AddrAddRq>
         <cus:CompanyNo>111</cus:CompanyNo>
         <cus:Address>
            <cus:AddrLine>aaa</cus:AddrLine>
            <cus:AddrLine>bbb</cus:AddrLine>
            <cus:AddrLine>ccc</cus:AddrLine>
            <cus:AddrTieBreaker>1</cus:AddrTieBreaker>
            <cus:City></cus:City>
            <cus:PostalCd></cus:PostalCd>
            <cus:ProvinceCd></cus:ProvinceCd>
            <cus:CountryCd></cus:CountryCd>
            <cus:CountryCd5></cus:CountryCd5>
            <cus:Province></cus:Province>
            <cus:CountyCd></cus:CountyCd>
            <cus:DeriveCityFromPostal></cus:DeriveCityFromPostal>
         </cus:Address>
      </cus:AddrAddRq>
   </soapenv:Body>
</soapenv:Envelope>


Output:
Code:
<NS1:AddrAddRq xmlns:NS1="http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer">
 <CompanyNo>111</CompanyNo>
 <Address>
  <NS2:AddrLine xmlns:NS2="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation">aaa</NS2:AddrLine>
  <NS3:AddrLine xmlns:NS3="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation">bbb</NS3:AddrLine>
  <NS4:AddrLine xmlns:NS4="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation">ccc</NS4:AddrLine>
  <NS5:AddrTieBreaker xmlns:NS5="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation">1</NS5:AddrTieBreaker>
  <NS6:City xmlns:NS6="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
  <NS7:PostalCd xmlns:NS7="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
  <NS8:ProvinceCd xmlns:NS8="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
  <NS9:CountryCd xmlns:NS9="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
  <NS10:CountryCd5 xmlns:NS10="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
  <NS11:Province xmlns:NS11="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
  <NS12:CountyCd xmlns:NS12="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
  <NS13:DeriveCityFromPostal xmlns:NS13="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation"/>
 </Address>
</NS1:AddrAddRq>


...I don't want to see the NS2 to NSx stuff... I don't understand why it would take the input namespaces and produce this kind of output.

My ESQL code that produces this is something like:
Code:
DECLARE cval NAMESPACE 'http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation';
DECLARE cval2 NAMESPACE 'http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer';
...
         DECLARE requestOperation CHARACTER Environment.variables.operationName||'Rq';
            SET OutputRoot.Properties.MessageSet = 'Customer_2007-09-08_B4.0';
            SET OutputRoot.Properties.MessageType = '{http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer}:'||requestOperation;
            SET OutputRoot.Properties.MessageFormat = 'XML1';

            SET OutputRoot.XMLNSC.cval2:{requestOperation}.*[]             = InputRoot.XMLNSC.cval:{requestOperation}.*[];


So I guess my question is:
1. Why does it produces this kind of output?
2. How do I get rid of it?

Thanks guys!
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jul 15, 2008 5:25 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I cannot answer your questions ( not yet, anyway ). But I can help you to diagnose the problem.
- Add two Trace nodes to your message flow, one after the input node, one just before the output node.
- Set the Pattern to '${Root}' on both Trace nodes
- Take a debug-level user trace while processing a message
- Inspect the user trace output. It will show you the message tree contents at the beginning of the flow, what the message flow did to it, and the what the tree looked like afterwards.
- Look very carefully at the namespaces on your elements.
Back to top
View user's profile Send private message
pottas
PostPosted: Tue Jul 15, 2008 5:49 am    Post subject: Reply with quote

Disciple

Joined: 27 Oct 2005
Posts: 185
Location: South Africa

Thanks for the prompt reply, Kimbert.

OK, I've traced the 'before' and 'after' of the message:

Before:
Quote:
(
(0x01000000):Properties = (
(0x03000000):MessageSet = 'CustomerValidation_2008-09-20_B1.0'
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2008-07-15 13:33:04.631'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-AXIS2'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'text/xml;charset=UTF-8'
(0x03000000):IdentitySourceType = ''
(0x03000000):IdentitySourceToken = ''
(0x03000000):IdentitySourcePassword = ''
(0x03000000):IdentitySourceIssuedBy = ''
(0x03000000):IdentityMappedType = ''
(0x03000000):IdentityMappedToken = ''
(0x03000000):IdentityMappedPassword = ''
(0x03000000):IdentityMappedIssuedBy = ''
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://localhost:7801/Customer/CustomerRequest HTTP/1.1'
(0x03000000):Content-Type = 'text/xml;charset=UTF-8'
(0x03000000):SOAPAction = '"http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation/AddrAdd"'
(0x03000000):User-Agent = 'Jakarta Commons-HttpClient/3.0.1'
(0x03000000):Host = 'localhost:7801'
(0x03000000):Content-Length = '944'
(0x03000000):X-Server-Name = 'localhost'
(0x03000000):X-Server-Port = '7801'
(0x03000000):X-Query-String = ''
)
(0x01000000):XMLNSC = (
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrAddRq = (
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:CompanyNo = '111'
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:Address = (
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrLine = 'aaa'
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrLine = 'bbb'
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrLine = 'ccc'
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrTieBreaker = '1'
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:City =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:PostalCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:ProvinceCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:CountryCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:CountryCd5 =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:Province =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:CountyCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:DeriveCityFromPostal =
)
)
)
)


After:
Quote:
(
(0x01000000):Properties = (
(0x03000000):MessageSet = 'Customer_2007-09-08_B4.0'
(0x03000000):MessageType = '{http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer}:AddrAddRq'
(0x03000000):MessageFormat = 'XML1'
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2008-07-15 13:33:04.631'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-AXIS2'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'text/xml;charset=UTF-8'
(0x03000000):IdentitySourceType = ''
(0x03000000):IdentitySourceToken = ''
(0x03000000):IdentitySourcePassword = ''
(0x03000000):IdentitySourceIssuedBy = ''
(0x03000000):IdentityMappedType = ''
(0x03000000):IdentityMappedToken = ''
(0x03000000):IdentityMappedPassword = ''
(0x03000000):IdentityMappedIssuedBy = ''
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://localhost:7801/Customer/CustomerRequest HTTP/1.1'
(0x03000000):Content-Type = 'text/xml;charset=UTF-8'
(0x03000000):SOAPAction = '"http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation/AddrAdd"'
(0x03000000):User-Agent = 'Jakarta Commons-HttpClient/3.0.1'
(0x03000000):Host = 'localhost:7801'
(0x03000000):Content-Length = '944'
(0x03000000):X-Server-Name = 'localhost'
(0x03000000):X-Server-Port = '7801'
(0x03000000):X-Query-String = ''
)
(0x01000000):XMLNSC = (
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer:AddrAddRq = (
(0x03000000):CompanyNo = '111'
(0x01000000):Address = (
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrLine = 'aaa'
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrLine = 'bbb'
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrLine = 'ccc'
(0x03000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:AddrTieBreaker = '1'
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:City =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:PostalCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:ProvinceCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:CountryCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:CountryCd5 =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:Province =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:CountyCd =
(0x01000000)http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation:DeriveCityFromPostal =
)
)
)
)


...the one thing that bothers me is that the namespace 'http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation' is on EVERY level of the output body. What did change, is the mentioned namespace changed to 'http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer', but only for the top-level element. Understandable, because my ESQL explicitly changed it. But the child elements inherits the namespace of the input message.

If I take each and every element of my input message and map it to the corresponding output element, it is fine. But this will be a monster task as I have 80+ operations that I need to handle through this node.

Thanks in advance
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Jul 15, 2008 6:35 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The message tree is like a DOM tree. Every node has its own namespace. You cannot change the namespace for an entire sub-tree just by changing the namespace declaration of its root element.
Sounds as if you need to change the namespace throughout the tree, though. So you need to write some ESQL which recursively walks the message tree and sets the namespace on every element. A long time ago, somebody posted some code to do this, but I think there may have been a defect in it, so I won't link to it.
Back to top
View user's profile Send private message
Gemz
PostPosted: Tue Jul 15, 2008 8:41 am    Post subject: Reply with quote

Centurion

Joined: 14 Jan 2008
Posts: 124

Hi,

Try it by declaring the namespace in your root element.

Code:
For Eg.

DECLARE S27 CHAR  'http://mqseries.net';
DECLARE S26 CHAR  'http://mqseries.net/1';

SET InputRoot.{S26}:rootElement.(XMLNSC.NamespaceDecl)xmlns:S27 = S27;
Back to top
View user's profile Send private message
paintpot
PostPosted: Tue Jul 15, 2008 9:55 am    Post subject: Reply with quote

Centurion

Joined: 19 Sep 2005
Posts: 112
Location: UK

Hi,
Alternative is to perform a transform:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
   <xsl:template match="cus:*" xmlns:cus="http://contracts.it.nednet.co.za/services/customer-services/2008-09-20/CustomerValidation">
     <xsl:element name="{name()}" namespace="http://contracts.it.nednet.co.za/services/customer-services/2007-09-08/Customer">
       <xsl:copy-of select="@*"/>
       <xsl:apply-templates/>
     </xsl:element>
   </xsl:template>
</xsl:stylesheet>
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Jul 16, 2008 12:30 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I like paintpot's idea - it's nice and simple.
Be aware, though, that it will be slower than using ESQL unless you put the XMLT node immediately after the input node.
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 » Namespaces in children elements
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.