users@jax-rpc.java.net

Using "removeNamespaceDeclaration()" is sometimes ignored

From: Karr, David <David.Karr_at_wamu.net>
Date: Mon, 08 Dec 2003 14:57:46 -0800

I'm constructing some SOAPElement objects, all of which at least need a
local name and a prefix. I'm putting the namespace and prefix in the
SOAP header. I'd like to have the resulting output only have the single
namespace declaration in the header, but have the enclosed elements use
the prefix, but without the namespace.

I'm having some luck with this, but it doesn't completely work.

I first added my namespace to the SOAP header like this:

        soapHeader.addNamespaceDeclaration(MY_PREFIX, MY_URI);

I then created the first SOAPElement going into the header (names
changed):

        SOAPElement myThing1Elem =
            soapFactory.createElement(MY_THING1_ELEM, MY_PREFIX,
MY_URI);
        myThing1Elem.removeNamespaceDeclaration(MY_PREFIX);

Seeing the resulting output, this appears to work. The element has a
local name and prefix, but no namespace declaration.

However, then I tried to add some sub-elements to the "thing1" element,
using similar code, and using SOAPElement.addChildElement() to add the
element, along with the "removeNamespaceDeclaration()" call.

In the resulting output, the structure is still correct, but the
children of "thing1" still have their namespace declarations. The calls
to "removeNamespaceDeclaration()" for the children of "thing1" were
seemingly ignored.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net