Thursday, January 31, 2002


Welcome to the MSDN Library Some interesting tips on SOAP interop using .NET. They did not mention any of the things I ran into today with namespaces.
4:14:52 PM  [Macro error: The file "D:\Program Files\Radio UserLand\www\#prefs.txt" wasn't found.]     

What Object Does SOAP Access? Sam Ruby has put up an interesting tutorial on understanding SOAP messages from an interop standpoint - Apach, Frontier (Radio), and ASP.NET. Nice article.
4:03:43 PM  [Macro error: The file "" wasn't found.]     

Simon Fell has an interop example, but I think it is wrong because the method name and parameter are not in the same namespace - and I think they have to be (in this case). Actually, the parameter in this example is not in any namespace.

Retraction: Simon says that the SOAP Section 5 encoding rules allow you to do just this. He says .NET gives you the flexibility - although I have not yet figured out how to do it - but Radio does not.
4:00:45 PM  [Macro error: The file "" wasn't found.]     


"Mark Woods is at the bleeding edge of SOAP interop.  [Scripting News]"

I was double-checking links in my post when I saw this! At first I thought I had clicked through to one of my own sites. Then I blushed when I realized Dave Winer had seen my post. And me, lurking in the background of Frontier and Radio for all these years. Then I got email from Jake Savin and Simon Fell. Honors and accolades at the age of 42!
3:52:40 PM  [Macro error: The file "" wasn't found.]     


Today Dave refers to an article about implementing web services (SOAP) and interop. As I am just starting down the .NET path, after doing XML-RPC and SOAP in Radio over the last year, I have to agree: .NET annotations appear to be an unnecessary overhead. At any rate, I thought I would try implementing the example .NET web service and then call it using Radio's built-in SOAP client. I had so much fun I even ate lunch at my desk today! I also learned a few things along the way.

Calling .NET From Radio: I already had the .NET Framework SDK installed so setting up the outlined example turned out to be a snap (copy and paste into Hello.asmx in my inetpubwwwroot directory). That was too easy. Then I hit a wall. I knew the method name to call, I knew the parameter name and its type, even the namespace, but how was I to figure out the invocation path, and the SOAPActionHeader? I had just purchased O'Reilly's Programming C# (a good book, btw) and found that I could point my browser to the just created .asmx file - http://localhost/Hello.asmx - for all of the answers! That is pretty cool. When you do this .NET generates a slick little page that describes the service, the methods available, and sample code for invoking the service using SOAP, HTTP-GET, or HTTP-POST. Now I had the SOAP Action header info I needed (which I probably would not have guessed for a while). It almost worked too.

When Interop Doesn't: I was able to invoke the web service successfully and got a valid return. However, the service was not accepting the parameter I was passing. It took my a long time to realize why and to figure out why the service would work when I was not passing a seemingly required parameter. It turns out that .NET scopes all services to an XML default namespace. If you do not name it, they provide one (http://tempuri.org/ - be sure to override this). There is no way to assign a prefix for the namespace. Radio Userland, however, does not currently allow the specification of a default name space, (that is, a namespace URI without a prefix) in the SOAP envelope. A quick hack to Radio and I had default namespace support in my SOAP envelopes. It works! This is so very cool! For my college intern friends I will even say "kewel", or maybe "sweet" just in case my daughter is reading this.

Interesting WSDL: In trying to figure out the optional required parameter I discovered that you can also get some dynamically generated WSDL for a .NET web service - this time by pointing my browser to http://localhost/Hello.asmx?wsdl. I dislike WSDL as much as anybody (it is so darn hard to read), but I did find that the parameter was being declared as optional in the WSDL. I can only assume that the SOAP framework somehow handles this anomoly by initializing missing parameters before calling the method.
3:19:28 PM  [Macro error: The file "" wasn't found.]     


" Read this article on Web Services interop. It's an eye-opener because they include sample code for a web service in .NET. Look at all the overhead. Did they really design an environment for web services? If so what are all those magic incantations about? I've seen Simon and Sam comment on this, their eyes can't see the overhead. But Sjoerd who's a scripting guy, sees it. Sometimes it pays to unlearn the things you take for granted. Make every bit of complexity justify itself, and if it can't, off to the bit bucket. Try Don's Amazing Puzzle for a demo of how hard it can be to see things you take for granted. My untrained eye sees six lines of overhead in the .NET hello world script.  [Scripting News]"
2:53:15 PM  [Macro error: The file "" wasn't found.]     

We have a number of internally useful SOAP-based web services laying around and I would like to take advantage of them using Radio's SOAP client. I have everything working just fine, but am encountering one small problem that I cannot figure out. Microsoft's .NET Framework SDK allows you to specify a namespace for the methods to be invoked, but not a prefix for it. In other words, all of your web service methods are defined within the scope of the XML default namespace.

Bypassing the arguments about the value of .NET or XML default namespaces, or my integrity as a developer for using .NET, I am unable to get Radio to create a SOAP envelope using a default namespace declaration for the method invoked. Digging into the code within soap.rpc.client it appears that if a namespace URI is provided, then a prefix is also required (and vice versa).

Am I missing something within Radio (or .NET)? Without the ability to declare a default namespace for my SOAP envelope, using soap.rpc.client, I can invoke .NET web services, but cannot successfully pass any parameters (which share the namespace for the method they are part of). I did a quick hack of the existing code to not require a namespace prefix, but I really dislike doing that. There must be another way.
2:49:51 PM  [Macro error: The file "" wasn't found.]