Scott Hanselman

Modifying the namespace PREFIX of the root node of the body of a SOAP Web Services Response....whew!

July 27, '03 Comments [6] Posted in Web Services | ASP.NET | XML
Sponsored By

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:

             <samlp:Response xmlns:samlp="thewholedurnthing">  

I'm producing via an ASMX :

             <Response xmlns ="thewholedurnthing" xmlns:samlp="thewholedurnthing">

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").

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Tuesday, 29 July 2003 07:14:01 UTC
Tuesday, 29 July 2003 09:16:41 UTC
Which part?
Tuesday, 29 July 2003 13:26:06 UTC
What do you actually mean by "Ouch .." ??? Really wondering ...
Tuesday, 29 July 2003 19:34:01 UTC
Maybe it was the ritual suicide?
Wednesday, 30 July 2003 01:59:58 UTC
The part where you have to deal with clients who should really choose to understand a technology before implementing it. :P
Wednesday, 30 July 2003 06:18:13 UTC
Ouch - ouch - ouch!!! ;-)
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.