Author |
Message
|
EricCox |
Posted: Wed Oct 17, 2012 10:21 am Post subject: WMB Namespace Declarations not Producing Expected Results |
|
|
Master
Joined: 08 Apr 2011 Posts: 292
|
To all,
My namespace declarations are not producing the expected results and I'm not able to adjust the code to produce the expected result. Could you tell me what I'm doing wrong, concepts missed, articles to read.
Thanks,
Eric
Here are the namespace delcarations and code to produce the XML:
Code: |
--Declare Namespaces
DECLARE soap_env NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
DECLARE nm2 NAMESPACE 'http://www.co.com/2012/10/02/CSG/IA/iaConsLoanWebService02';
DECLARE nm3 NAMESPACE 'http://www.co.com/2012/10/02/CSG/IA/iaConsLoanWebService02';
-- Create the SOAP Envelope
SET OutputRoot.XMLNS.soap_env:Envelope.(XML.NamespaceDecl)xmlns:"NS1" = 'http://schemas.xmlsoap.org/soap/envelope/';
SET OutputRoot.XMLNS.soap_env:Envelope.(XML.NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNS.soap_env:Envelope.(XML.NamespaceDecl)xmlns:xsd = 'http://www.w3.org/2001/XMLSchema';
--Create the ResponseMessageHeader
SET OutputRoot.XMLNS.soap_env:Envelope.soap_env:Header.nm2:ResponseMessageHeader.(XML.NamespaceDecl)xmlns:"NS2" = 'http://www.co.com/2012/10/02/CSG/IA/iaConsLoanWebService02/';
--Set the Header
SET OutputRoot.XMLNS.soap_env:Envelope.soap_env:Header.nm2:ResponseMessageHeader = '';
--Set the Body
SET OutputRoot.XMLNS.soap_env:Envelope.soap_env:Body.{serviceName} = '';
--Populate the Result
DECLARE resp REFERENCE TO OutputRoot.XMLNS.soap_env:Envelope.soap_env:Body.{serviceName};
DECLARE hdr REFERENCE TO OutputRoot.XMLNS.soap_env:Envelope.soap_env:Header.nm2:ResponseMessageHeader;
--Build the SOAP Header
--SET OutputRoot.XMLNS.soap_env:Envelope.soap_env:Header.(XML.NamespaceDecl)xmlns:"cfg_hdr" = 'http://www.co.com/schemas/CFX/';
SET hdr.ErrorList.Status =
'2';
|
And here is the result:
Code: |
<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<NS1:Header>
<NS1:ResponseMessageHeader xmlns:NS1="http://www.co.com/2012/10/02/CSG/IA/iaConsLoanWebService02" xmlns:NS2="http://www.co.com/2012/10/02/CSG/IA/iaConsLoanWebService02/">
<ErrorList>
<Status>2</Status>
</ErrorList>
</NS1:ResponseMessageHeader>
</NS1:Header>
<NS1:Body>
<getCustConsLoanAcctsRs/>
</NS1:Body>
</NS1:Envelope>
|
What I'm expecting to produce is this:
Code: |
<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<NS1:Header>
<NS2:ResponseMessageHeader xmlns:NS2="http://www.co.com/2012/10/02/CSG/IA/iaConsLoanWebService02/">
<ErrorList>
<Status>2</Status>
</ErrorList>
</NS2:ResponseMessageHeader>
</NS1:Header>
<NS1:Body>
<getCustConsLoanAcctsRs/>
</NS1:Body>
</NS1:Envelope>
|
The NS1 is being declared inside the ResponseMessageHeader where I don't want it and the ResponseMessageHeader isn't being prefixed with NS2 as I want it.
I'll keep trying to experiment.
Thanks to all,
Eric[/code] |
|
Back to top |
|
 |
kimbert |
Posted: Thu Oct 18, 2012 2:41 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The output document will be constructed from the contents of the output message tree. No involvement from any other settings. So I suggest that you add a Trace node to your flow immediately before the output node. Set the pattern to '${Root}'. Check that the output tree is exactly the way that you intended. If you don't find the problem, post the Trace node output.
Any particular reason why you are using XMLNS instead of XMLNSC? |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Oct 18, 2012 5:08 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
|
Back to top |
|
 |
NealM |
Posted: Thu Oct 18, 2012 9:26 am Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Quote: |
Any particular reason why you are using XMLNS instead of XMLNSC? |
Probably because last month on another topic post, I copied and pasted some old working v5 ESQL for him to see how to set up for and build a SOAP Envelope in v6.0, a step up from trying to use the XML parser.
One small step at a time... |
|
Back to top |
|
 |
rekarm01 |
Posted: Sat Oct 20, 2012 12:15 pm Post subject: Re: WMB Namespace Declarations not Producing Expected Result |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
The XML parsers implicitly add namespace declarations with default names "NS1", "NS2", etc., to the output message when the message does not provide a required namespace declaration. If the message flow is also explicity creating namespace declaration elements "NS1", "NS2", etc., then it's hard to tell them apart.
EricCox wrote: |
Code: |
--Set the Header
SET OutputRoot.XMLNS.soap_env:Envelope.soap_env:Header.nm2:ResponseMessageHeader = '';
--Set the Body
SET OutputRoot.XMLNS.soap_env:Envelope.soap_env:Body.{serviceName} = ''; |
|
This may not be related to the problem at hand, but don't do that. These are Name elements; they don't need values, (not even an empty string). ResponseMessageHeader already exists, so the SET statement is unnecessary. To create the {serviceName} element, use:
Code: |
SET OutputRoot.XMLNS.soap_env:Envelope.soap_env:Body.{serviceName} TYPE = Name; |
or, use a CREATE statement. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Oct 21, 2012 7:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Code: |
SET OutputRoot.XMLNS.soap_env:Envelope.(XML.NamespaceDecl)xmlns:"NS1" = 'http://schemas.xmlsoap.org/soap/envelope/'; |
Why did you use NS1 instead of soap_env?
Is this because you have a non standard parser on the other end that expects NS1, NS2 etc...and those in a specific order?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|