Scott Hanselman

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

July 27, 2003 Comment on this post [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
Hosting By
Hosted in an Azure App Service
July 29, 2003 11:14
July 29, 2003 13:16
Which part?
July 29, 2003 17:26
What do you actually mean by "Ouch .." ??? Really wondering ...
July 29, 2003 23:34
Maybe it was the ritual suicide?
July 30, 2003 5:59
The part where you have to deal with clients who should really choose to understand a technology before implementing it. :P
July 30, 2003 10:18
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.