Author |
Message
|
smeunier |
Posted: Fri Nov 11, 2005 1:50 pm Post subject: Long Namespaces resolving to Short Namespace in XMLNS Domain |
|
|
 Partisan
Joined: 19 Aug 2002 Posts: 305 Location: Green Mountains of Vermont
|
I'm trying to work through a problem, where my generated namespaces are resolving to default shortname spaces in the final XML message:
Given the following:
DECLARE NS_Root NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
--Create an XML Declaration
SET OutputRoot.XMLNS.(XML.XmlDecl)='';
--Set the Version within the XML Declaration
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version)='1.0';
--Set the Encoding within the XML Declaration
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML."Encoding")='UTF-8';
-- Set NameSpace
Set OutputRoot.XMLNS.(XML.Element)NS_Root:"MD_SAP_BO_zcpaup01".(XML.NamespaceDecl)"xmlns:MD_SAP_BO_zcpaup01"='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
Set OutputRoot.XMLNS.(XML.Element)NS_Root:"MD_SAP_BO_zcpaup01".NS_Root:"Control_record"= '';
Resolves to in the output stream:
<?xml version="1.0" encoding="UTF-8"?>
<NS1:MD_SAP_BO_zcpaup01 xmlns:NS1="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01" xmlns:MD_SAP_BO_zcpaup01="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01" xmlns:MD_SAP_BO_sap_idoccontrol="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_idoccontrol" xmlns:MD_SAP_BO_zcpaup01_cwdata="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01_cwdata" xmlns:MD_SAP_BO_zcpaup01_z2cokup="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01_z2cokup" xmlns:bx="http://www.ibm.com/websphere/crossworlds/2002/BOSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01 C:\IBM\WebSphereAdapters\Tools\WSWB203\workspace\MD_SAP\BusinessObjects\MD_SAP_BO_zcpaup01.xsd" version="0.0.0" delta="false" verb="Create">
<NS1:Control_record>
I'm expecting the specified Namespace and not the default. I'm sure I'm missing something simple here. Any toughts? Message Set is used for parsing inbound message and set for Namespace usage, but it is not really used in this context. |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Nov 11, 2005 9:46 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Are you using an Ouptut Message Set too....If Yes, then check if the Namespaces have been activated there too.
Next what you will need is a reference to the Ouptut IDoc(ur code seems to be similar to an IDoc)
Something like:
Code: |
DECLARE ref_idoccontrol REFERENCE TO OutputRoot.MRM.sap_root:Control_record.sap_idoccontrol:sap_idoccontrol; |
where you should have declared Namespaces for each of the required namespaces(segments that u need to generate in output)
i.e something like this
Code: |
DECLARE sap_idoccontrol NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/sap_idoccontrol';
DECLARE sap_root NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/FEU_ECLIPSE_SAP_z2wmstklvl001';
DECLARE sap_data NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/FEU_ECLIPSE_SAP_z2wmstklvl001_cwdata';
DECLARE sap_z2stklvlh000 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/FEU_ECLIPSE_SAP_z2wmstklvl001_z2stklvlh000';
DECLARE sap_z2stklvli000 NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/FEU_ECLIPSE_SAP_z2wmstklvl001_z2stklvli000'; |
Only now will MB reference the namespaces of the output Message....Everytime you create a new segment remember to DECLARE a reference from the output message as above.
Regards. |
|
Back to top |
|
 |
smeunier |
Posted: Sat Nov 12, 2005 10:59 am Post subject: |
|
|
 Partisan
Joined: 19 Aug 2002 Posts: 305 Location: Green Mountains of Vermont
|
The action that is trying to be performed, is an inbound IDOC structure to the MessageBroker. The Message Flows compute node is trying to convert the inbound IDOC (Message Set used for mapping), to a XMLNS formatted messages which is sent to the mySAP.com adapter. The action you describe, is for outbound process, which I have working just fine. In that scenario, I have a MessageSet with both physical formats of CWF(for IDOC mapping) and CWXML(For NameSpace resolution).
For this scenario(IDOC to XMLNS) conversion, I have a MessageSet with Physical Formats of CWF and CWXML(should this be something else?), same as above. But still I get default namespace assignments..
Thought? |
|
Back to top |
|
 |
TonyD |
Posted: Sun Nov 13, 2005 12:41 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Removal of the double quotes around "xmlns:NS_Root" in the declaration, as shown below:
Code: |
-- Set NameSpace
Set OutputRoot.XMLNS.(XML.Element)NS_Root:"MD_SAP_BO_zcpaup01".(XML.NamespaceDecl)xmlns:NS_Root ='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
|
produces this result:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<NS_Root:MD_SAP_BO_zcpaup01 xmlns:NS_Root="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01">
<NS_Root:Control_record></NS_Root:Control_record>
</NS_Root:MD_SAP_BO_zcpaup01>
|
If you do not want the namespace prefix in the output message change the declaration to:
Code: |
-- Set NameSpace
Set OutputRoot.XMLNS.(XML.Element)NS_Root:"MD_SAP_BO_zcpaup01".(XML.NamespaceDecl)xmlns ='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
|
and you will get:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<MD_SAP_BO_zcpaup01 xmlns="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01">
<Control_record></Control_record>
</MD_SAP_BO_zcpaup01>
|
|
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 14, 2005 2:51 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The behaviour which you are seeing is as-designed. The message broker does not carry namespace prefixes from input to output ( because they have no business meaning ). You can get the result you want, though.
In Message Set 'CWXML', open the file 'messageset.mset', and go to the XML properties. You will find a table where you can set up preferred prefixes for your namespaces. |
|
Back to top |
|
 |
juddg |
Posted: Mon Nov 14, 2005 3:22 am Post subject: |
|
|
Apprentice
Joined: 22 Nov 2004 Posts: 33
|
Hi,
I presume from the initial post that you want the prefix "MD_SAP_BO_zcpaup01" to be used in the output document not the prefix "NS1". In which case you need to remove the xmlns: from the double quotes when setting the xmlns attribute prefix in the ESQL otherwise it treats everying in the double quotes as a name not as a namespace prefix and a name. ie change :
Set OutputRoot.XMLNS.(XML.Element)NS_Root:"MD_SAP_BO_zcpaup01".(XML.NamespaceDecl)"xmlns:MD_SAP_BO_zcpaup01"='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
to
Set OutputRoot.XMLNS.(XML.Element)NS_Root:"MD_SAP_BO_zcpaup01".(XML.NamespaceDecl)xmlns:"MD_SAP_BO_zcpaup01"='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
Regards,
juddg |
|
Back to top |
|
 |
smeunier |
Posted: Mon Nov 14, 2005 6:14 am Post subject: |
|
|
 Partisan
Joined: 19 Aug 2002 Posts: 305 Location: Green Mountains of Vermont
|
I certainly appreciate all the help being offered. After much effort and trial and error, I was able to "partially" get this to work, where the XML output has the generated NameSpaces. This worked with the first layer(sample below), however subsequent layer revert to the default namspaces, with no error, and for the life of me I cannot figure out why. Also there has been discussion about NS prefixes defined in the message sets. This to me seems like a cleaner way, and infact, when producing non NS IDOC formats, but needing to reference the incoming XML with NS, is use this method. It would seem, that the same should be true on the inbound side, where an IDOC format comes in and an XML NS format goes out. I have a CWF for IDOC parser reference, and a CWXML for NS declarations. However, these declaration seem to be ineffective, or maybe I just don't know how to use multiple message formats in a single message.
Using the ESQL way, I'm able to get the top level to come out ok, but secondary level in the generated output assumes the defaults:
Name Space Declarations:
Code: |
DECLARE NS_Root NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
DECLARE NS_control NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_idoccontrol';
DECLARE NS_cwdata NAMESPACE 'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01_cwdata';
|
Name Space Association:
Code: |
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.(XML.NamespaceDecl)xmlns:MD_SAP_BO_zcpaup01='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01';
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.(XML.NamespaceDecl)xmlns:MD_SAP_BO_sap_idoccontrol='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_idoccontrol';
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.(XML.NamespaceDecl)xmlns:MD_SAP_BO_sap_cwdata='http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_cwdata';
|
Usage:
Code: |
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.Control_record= '';
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.Control_record.NS_control:"MD_SAP_BO_sap_idoccontrol".(XML.Attribute)version='0.0.0';
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.Control_record.NS_control:"MD_SAP_BO_sap_idoccontrol".(XML.Attribute)delta='false';
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.Data_record= '';
-- Create cwdata Record
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.Data_record.MD_SAP_BO_zcpaup01_cwdata= '';
Set OutputRoot.XMLNS.MD_SAP_BO_zcpaup01.Data_record.NS_cwdata:"MD_SAP_BO_zcpaup01_cwdata".(XML.attr)version='0.0.0';
|
Yeilds this:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<MD_SAP_BO_zcpaup01 xmlns:MD_SAP_BO_zcpaup01="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01" xmlns:MD_SAP_BO_sap_idoccontrol="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_idoccontrol" xmlns:MD_SAP_BO_sap_cwdata="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_cwdata" xmlns:MD_SAP_BO_sap_z2cokup="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_z2cokup" xmlns:bx="http://www.ibm.com/websphere/crossworlds/2002/BOSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:NS1="xsi" NS1:schemaLocation="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01 C:\IBM\WebSphereAdapters\Tools\WSWB203\workspace\MD_SAP\BusinessObjects\MD_SAP_BO_zcpaup01.xsd" version="0.0.0" delta="false" verb="Create">
<Control_record>
<MD_SAP_BO_sap_idoccontrol:MD_SAP_BO_sap_idoccontrol version="0.0.0" delta="false" verb="Create">
<MD_SAP_BO_sap_idoccontrol:Name_of_table_structure>EDI_DC40 </MD_SAP_BO_sap_idoccontrol:Name_of_table_structure>
</MD_SAP_BO_sap_idoccontrol:MD_SAP_BO_sap_idoccontrol>
</Control_record>
<Data_record>
<MD_SAP_BO_zcpaup01_cwdata></MD_SAP_BO_zcpaup01_cwdata>
<NS2:MD_SAP_BO_zcpaup01_cwdata xmlns:NS2="http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01_cwdata" version="0.0.0"/>
</Data_record>
|
Desire output is something like this:
Code: |
.
.
.
<MD_SAP_BO_sap_idoccontrol:IDoc_type> </MD_SAP_BO_sap_idoccontrol:IDoc_type>
<MD_SAP_BO_sap_idoccontrol:ObjectEventId>String</MD_SAP_BO_sap_idoccontrol:ObjectEventId>
</MD_SAP_BO_sap_idoccontrol:MD_SAP_BO_sap_idoccontrol>
</Control_record>
<Data_record>
<MD_SAP_BO_zcpaup01_cwdata:MD_SAP_BO_zcpaup01_cwdata version="0.0.0" delta="false" locale="String" verb="Create">
<MD_SAP_BO_zcpaup01_cwdata:MD_SAP_BO_zcpaup01_z2cokup size="1">
<MD_SAP_BO_zcpaup01_z2cokup:MD_SAP_BO_zcpaup01_z2cokup version="0.0.0" delta="false" locale="String" verb="Create">
<MD_SAP_BO_zcpaup01_z2cokup:PLANT>Stri</MD_SAP_BO_zcpaup01_z2cokup:PLANT>
.
.
.
|
|
|
Back to top |
|
 |
juddg |
Posted: Mon Nov 14, 2005 6:31 am Post subject: |
|
|
Apprentice
Joined: 22 Nov 2004 Posts: 33
|
Hi,
The reason that you are getting NS2 being used as the prefix is that the namespace declaration specifies the namespace :
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_zcpaup01_cwdat''
but the in the XML.NamespaceDecl you sepcify thenamespace :
'http://www.ibm.com/websphere/crossworlds/2002/BOSchema/MD_SAP_BO_sap_cwdata'
Regards,
juddg. |
|
Back to top |
|
 |
|