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:

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

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

Ender's Job - Software Engineer or Protector of Mankind?

July 22, '03 Comments [0] Posted in Web Services | Gaming | Tools
Sponsored By

A great analysis of how Ender's Game (one of my all time favorite books, I've read the whole series) can teach us about software engineering.  I'm re-reading the Pragmatic Programmer now and I didn't realize that Andy and Dave were blogging. RSS Subscribed.

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

Finding out the name of the EVERYONE Group on a non-english (International) version of Windows

July 21, '03 Comments [1] Posted in Web Services | Internationalization
Sponsored By

I preach a lot about awareness around issues of Internationalization.  Issues arise when we make assumptions.  For example, if you have code that assumes the security group "Everyone" is called "Everyone" on a non-english Windows box...well, you can guess that "results are not guaranteed."

Typically (in C++/SDK) you don't refer to these groups by name, but rather by SID.  Depending on what you're doing, there's a number of ways to figure these things out.  Perhaps instead of using “Everyone,” use the Everyone SID: (S-1–1–0)

You may want to call AllocateAndInitializeSid...see Creating Security Descriptor and most importantly the list of Well-Known SIDs.

Call AllocateAndInitializeSid to obtain the SID of the Everyone group. In the parameters passed to AllocateAndInitializeSid, the number of subauthorities in the SID is set to 1, and the value of the first subauthority is set to SECURITY_WORLD_RID.

PSID BuildEveryoneSid() {
   SID_IDENTIFIER_AUTHORITY auth = SECURITY_WORLD_SID_AUTHORITY;
   PSID pSID = NULL;
   BOOL fSuccess = AllocateAndInitializeSid(&auth, 1,
      SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pSID);
   return(fSuccess ? pSID : NULL);
} //(Call FreeSid() when you’re done…)

Or, call LookupAccountSID and receive the name as an out parameter.

Or, use this Russian fellow's old util. http://www.chem.msu.su:8080/~rudnyi/NT/sid.txt (sid2user, user2sid, source code here.) from the command line or script and get output like this: 

C:\Documents and Settings\SHanselm\Desktop\Utils>user2sid "Everyone"
S-1-1-0
Number of subauthorities is 1
Domain is
Length of SID in memory is 12 bytes
Type of SID is SidTypeWellKnownGroup

C:\Documents and Settings\SHanselm\Desktop\Utils>sid2user 1 S-1-1-0
Name is Everyone
Domain is
Type of SID is SidTypeWellKnownGroup

I'm sure there's a way to do with from both Windows Scripting Host (VBS) and .NET (C#) given a SID, so if you know, let me know.

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

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