We have also detected lots of problems while using namespaces.
The only way to maintain the namespace declarations is “hardcoding” them in the nsDecls parameter (that means you need to know which namespaces will appear in design time rather than in execution time…). In addition, the use of this parameter only allows to place the namespaces definitions in the root tag (if the original document had some declarations in another tag, they will be moved).
Another option is changing the document definition by adding the namespaces declarations as atttributes (with the name @xmlns). Once populated in a service you can then execute documentToXMLString without providing the nsDecls parameter.
Unfortunatelly, all the solutions are just work-arounds as no dynamic handling of the namespaces is allowed.
#webMethods#webMethods-General#Integration-Server-and-ESB