We've built a web-service application on SwitchYard (Fuse Service Works 6.0 GA) and it was noticed that response messages we sent back to clients calling our web-service defined the prefix used for the soap-envelope name-space in the opening Envelope tag of the message (expected) then immediately redefined the prefix to be used in the next line for the soap Header block.
Our partner, responsible for building the client that will consume this web-service, has asked if we could fix the prefix used for various name-spaces in the message such as the soap-envelope name-space. (No need to debate whether we *should* do this, that discussion has been held. Here we're only looking to learn whether we *could* do this. )
To achieve this, we created an interceptor, extending AbstractSoapInterceptor and inserted it into the chain at the PREPARE_SEND stage in whose handleMessage method we create a Map<String,String> to hold prefix, name-space pairs and we save this map to the message's contextual properties map using the key "soap.env.ns.map". In addition, we also add another property whose key/value is "disable.outputstream.optimization"/true because we'd seen a number of sources that recommended that.We also registered our interceptor as an out-interceptor in our switchyard.xml in the expected manner.
So - that all worked more or less. For the purposes of experimentation only, we created the following prefix/name-space definitions in our map:
When we then tested this we found that the first tag in our response message paid heed to this new configuration and used "billybobthornton" as the prefix. However, the Header tag that followed was again immediately redefined as it was originally.
The 'billybobthornton' prefix was used for all parts after the Header block (so the override to use 'env' only seems to apply to the Header block) but we also noted that our other defined prefixes (abc, def etc) were never used and 'stock' prefixes of the form 'ns1', 'ns2' etc were used instead for those parts of the message. (They relate to the content parts of our message in the Body section of the main soap message, FYI)
The question therefore is given the use of the interceptor and the fact it initially appears to have an affect on the outer-most Envelope block, why does the Header block of the message get its prefix redefined and why don't our other prefix selection preferences get chosen?
If anyone can unravel this mystery for us, we'll be eternally grateful.