msweb.py, a Python wrapper for Microsoft.com Web Services 1.0. Requires no special libraries beyond a working XML parser (included in most Python distributions). Implements WS-Security with 5 lines of code and a print statement. (Sam implemented the 5 lines, and I implemented the print statement.)

OK, I did a little more than that. Some of the initial reverse engineering via wire traces, and some of the initial unmarshalling work. However, I take no responsibility for the part of the unmarshaller that converts high-bit characters to their numeric entity equivalent, which Sam wrote purely to annoy Aaron.

Also thanks to Phillip Pearson for uncovering the publicly available documentation, the address of which was clearly documented in the help file which was installed alongside the sample source code which was installed by the Windows installer which would only install over Visual Studio .NET.

I know an old lady who swallowed a fly…

Also, this:

But Mr. Dent, the plans have been available in the local planning office for the last nine months.

Oh yes, well, as soon as I heard I went straight round to see them, yesterday afternoon. You hadn’t exactly gone out of your way to call attention to them, had you? I mean, like actually telling anybody or anything.

But the plans were on display…

On display? I eventually had to go down to the cellar to find them.

That’s the display department.

With a flashlight.

Ah, well, the lights had probably gone.

So had the stairs.

But look, you found the notice, didn’t you?

Yes, said Arthur, yes I did. It was on display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying ‘Beware of the Leopard.’)

Wire traces? Custom data marshallers? Leopards? Yeah, yeah, tell me about it. I’d love to just point my Python IDE at the MsCom WSDL file (also clearly documented in the help file which was installed alongside the…) and have it write my code for me. Someday perhaps we will all be using perfect tools that encapsulate all of this for us behind deceptively simple-looking high-level function calls. Remember, though, that every design has an absolute floor of complexity. Implementations can move it or hide it, but they can’t reduce it beyond a certain point without changing the design.

Microsoft’s sample code looks as simple as a VB coder’s Hello World program (provided you install the latest version of the .NET framework and the Web Services Enhancements Service Pack). Phillip tried using high-level SOAP tools in Python and failed miserably, but he succeeded with mid-level SOAP tools and a custom unmarshaller. Sam and I succeeded with lower-level tools. It may also be possible to succeed with even fewer tools (for instance, unmarshalling the responses without a real XML parser). The total complexity of the system is roughly the same in each case; the only difference is who shoulders the burden of that complexity. The bits on the wire are always the same.

§

Five comments here (latest comments)

  1. Funny, as I read the first few paragraphs of your previous post, I was thinking of the Beware of the Leopard reference too. Obviously MS are really keen for developers to adopt this system :-/ .

    — Neil T. #

  2. I love Python’s printf implementation. I wish more languages would support it.

    So, except for Top downloads, what are the real goodies Microsoft.com Web Services allows us to access?

    — Jesper #

  3. That should read “character entity references”. The data returned is riddled with the utf-8 encodings of reg and mdash. I, on the other hand, like to use the Python print statement and don’t yet have the Unicode numeric equivalents for these characters memorized. Annoying Aaron is just a bonus.

    Also, the five lines of code should be attributed to Phillip Pearson.

    — Sam Ruby #

  4. Feelin’ the love!

    — Aaron Swartz #

  5. Go go Gadget Ethereal just doesn’t have the same flavor, does it?

    — kami #

Respond privately

I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)



§

firehosecodeplanet

© 2001–9 Mark Pilgrim