The views expressed on this weblog are mine alone and do not necessarily reflect the views of my employer.
 Sunday, July 27, 2003
Modifying the namespace PREFIX of the root node of the body of a SOAP Web Services Response....whew!

I've got a client who doesn't fundamentally understand SOAP, much less XML.  They are insisting on a specific prefix for elements in a SOAP Response we are sending to them.

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>

and they are not digging it.  Certainly the prefix doesn't matter as the InfoSet is semantically the same.  I suspect the client (who is using Java) is manually <gasp> parsing the Response.

I'm hoping to cover this experience in an upcoming PADNUG talk now tenatively entitled "How NOT to do Web Services: Is ritual suicide the only answer?"

I messed around with the obvious XmlRoot and XmlType attributes and observed they were being wholly ignored for the Root Element of the resulting SOAP payload.  I talked to Christian Weyer and Herr Vasters who confirmed that it is 99.9% not possible via simple attributes. 

So, taking their advice I will write a quickie SoapExtension, probably something along the lines of:
     XmlRootForcePrefix(prefix="samlp", namespace="thewholedurnthing").


Updated Link to this post 7:25:44 PM  #    comment []  trackback []