To prefix or not to prefix - this is *not* the question
UPDATE: Scott now has the 'bits' up on his blog.
I hope a lot, if not all, readers of my blog understand the sense and concept
of the XML
InfoSet. And additionally what XML Namespaces are, what they are for - and what not!?
Scott, Clemens and
myself had an email conversation yesterday about a very stange but also very
interesting 'problem':
They want:
<soap:body>
<samlp:Response
xmlns:samlp="thewholedurnthing">
<samlp:somestuff>
I'm producing via an ASMX :
<soap:body>
<Response xmlns ="thewholedurnthing"
xmlns:samlp="thewholedurnthing">
<samlp:somestuff>
Scott has a customer who insists on having a certain XML Namespace prefix be
present in the first element of the SOAP Body's response. Well, this is of
course a silly and unnecessary wish ... but it is the customer :-)
So we tried and spinned our heads around and came to the conclusion that it
is currently (version 1.x of ASMX) not possible to achieve this goal with
ASP.NET Xml Web Services by simply adding and playing with the usual supsects. Furthermore, I got a confirmation of a MS employee
who was responsible for a lot of things in the ASMX/XmlSerializer
architecture:
Yes we get this question quite a bit. The answer is it just wasn't a
high priority for us, given that the "namespaces in xml" spec is quite
explicit that the prefix doesn't matter. maybe you could try to convince your
customer it doesn't matter? it's important that we get the word out about
that... ;)
Enough said.
Lessons learned: If you really have to have this 'feature',
use a custom SoapExtension to modify the SOAP streams. Perhaps Scott
will show up with such a version soon ...