tsJensen

A quest for software excellence...

WSDL.EXE Problem in .NET 2.0

I wanted to play with the Amazon Alexa Web Search Platform (AWS) web service, so I fired up Visual Studio 2005 and created a new Windows Forms project. I then tried to add a web reference to the AWS url. The GUI interface to wsdl.exe threw up all over it, so I tried it manually after running the trusty sdkvars.bat to make sure my environment variables were set. Here's the result (not pretty):

------------------------------------------------------------------------------------------------------
c:\>wsdl /o:test.cs http://awis.amazonaws.com/AlexaWebSearchPlatform/2005-12-01/AlexaWebSearchPlatform.wsdl
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: There was an error processing 'http://awis.amazonaws.com/AlexaWebSearchPlatform/2005-12-01/AlexaWebSearchPlatform.wsdl'.
- The document at the url http://awis.amazonaws.com/AlexaWebSearchPlatform/2005-12-01/AlexaWebSearchPlatform.wsdl was not recognized as a known document type.

The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'Discovery document at the URL http://awis.amazonaws.com/AlexaWebSearchPlatform/2005-12-01/AlexaWebSearchPlatform.wsdl could not be found.'.
- The document format is not recognized.
- Report from 'WSDL Document' is 'There is an error in XML document (140, 3).'.
- The element was not expected in this context: ... Expected elements: http://www.w3.org/2001/XMLSchema:include, http://www.w3.org/2001/XMLSchema:import, http://www.w3.org/2001/XMLSchema:redefine, http://www.w3.org/2001/XMLSchema:simpleType, http://www.w3.org/2001/XMLSchema:complexType, http://www.w3.org/2001/XMLSchema:annotation, http://www.w3.org/2001/XMLSchema:notation, http://www.w3.org/2001/XMLSchema:group, http://www.w3.org/2001/XMLSchema:element, http://www.w3.org/2001/XMLSchema:attribute, http://www.w3.org/2001/XMLSchema:attributeGroup.- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.

If you would like more help, please type "wsdl /?".
------------------------------------------------------------------------------------------------------

So I wondered how VS .NET 2003 would do with Amazon's WSDL. Changed directories to make sure I was running 1.1 of wsdl.exe and ran the same command line. It ran flawlessly. Here's the output:

------------------------------------------------------------------------------------------------------
c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin>wsdl /o:test.cs http://awis.amazonaws.com/AlexaWebSearchPlatform/2005-12-01/AlexaWebSearchPlatform.wsdl
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Writing file 'test.cs'.
------------------------------------------------------------------------------------------------------

Opened VS .NET 2003 and created a little test project and it created the proxy just fine. I noticed that the WSDL file it created in the project was slightly different from the one downloaded directly from the Amazon URL. Specifically, the nodes with no namespace designation such as <definitions> and <types> now had a namespace prefix <wsdl:definitions> and <wsdl:types> along with the namespace declaration in the <definitions> node changed from xmlns="http://schemas.xmlsoap.org/wsdl/" to xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/".

I closed VS .NET 2003 and opened VS 2005. Now I used the "Add Web Reference" and referenced the local AlexaWebSearchPlatform.wsdl file that VS .NET 2003 had created. Now I have a proxy that at least compiles, but of course it does not reference the Amazon URL directly so update web reference will not work.

I'll start testing using the 2003 to 2005 proxy generated class and report back tomorrow on how well it worked. Meantime, if anyone can tell me how to get the wsdl.exe for .NET 2.0 to behave, I'd appreciate it.

DotNetNuke 4.0 Go To Definition

I spent a few hours this week exploring DNN 4.0 and the team's effort to transform the successful 3.x version into the ASP.NET 2.0 mold. I congratulate the team. They had a lot of work to do and I found the installation and setup easy and the module template is a joy.

Of course, I wish they had chosen C# but that's my own bias. The beauty is that you can add a C# module using the module template right into the DNN web application. Everything seems to work as advertised, EXCEPT...

Open the C# module code generated by the template and right-click on an class name that's part of the DNN source code and select the "Go to Definition" menu option. Hey, where did the code go. I get a C# [meta data] file just like I would with a BCL class rather than the object browser. EXCEPT there is really code available but it's VB.NET.

So I have my first complaint about VS 2005. I'm hoping a reader can help me find the solution. In a mixed language solution, why doesn't the real code open up? Is this a bug or am I missing some configuration thing? First person to help me find the solution get's a $20 Amazon gift certificate, unless I post the solution here first.

One way or the other, I like DNN 4.0 a lot. Sure there's more comprehensive portal and content management systems available, but definitely not for the price. I'm sure I'll run into more trouble as I roll down the .NET 2.0 road, but so far, it's been a lot of fun. Here's to more of it.

Pick Up the Scissors and Run

I've had VS.NET 2005 and SQL Server 2005 installed for a couple of days now. Thanks to the MSDN subscription site. So far, I'm very impressed. The question remains how and when do we make the move. I say, run with the scissors.

The cutting edge, if you can define this as cutting edge, is not quite as sharp as one might think given we've been through beta one and two and the community technology previews (CTP). But for those of you who did install the betas (and by what I've read and heard there are thousands of you), be warned! The SQL Server install is a pain if it detects any whiff of beta. I was finally successful after uninstalling even the previous .NET frameworks.

That said, I'm still recommending running with the scissors. Okay, well, walk quickly anyway. Plan to migrate as quickly as possible without totally disrupting your current development paths. Here's my list of reasons to do it. I'm sure there's many more, but it's a start.

ADO.NET

  • Bulk updates: 1,000,000 row insert for 1.1: 30 minutes; for 2.0: 45 seconds
  • Dataset binary serialization in remoting: faster DS over the wire (up to 6 times smaller)
  • DataTable now supports XML read, write, schema, merge, load
  • DataView.ToTable method allows creation of a new DataTable from a view

C# 2.0

  • Generics: generic class later cast to a specific type. Collections are the best example: a list of some type: List<someType>
  • Anonymous methods: allows code to be passed as a parameter rather than requiring a delegate
  • Partial classes: allows a class to be defined and worked on in two or more files

ASP.NET

  • AJAX: direct support for asynchronous javascript calls to the server with javascript generation automated and easy event handling in the code-behind code of the page.
  • Master pages: allows visual inheritance or a base class page
  • DataSource & ObjectDataSource allow easier binding to data aware controls

Visual Studio .NET 2005

  • Click-Once deployment of smart client
  • Editor: improved color coding and intellisense
  • Debugger will suggest potential problem areas
  • Warnings suggesting specific replacements for code that uses deprecated or obsolete framework objects
  • Debugger allows data visualization: view a dataset in a grid while debugging
  • Conversion of previous VS.NET projects easy, automated, informative reports

SQL Server 2005

  • PIVOT/UNPIVOT allows rows and column rotation
  • APPLY allows use of a UDF in a FROM clause to create a result set with calculated columns
  • TRY/CATCH allows more granular exception handling
  • CTE (Common Table Expressions) allow the creation of a recursive query to produce a hierarchical resultset
  • CLR integration allows stored procedures to be written in C#

ASP.NET is NOT ASP

I enjoy reading Fawcette publications online as one source of industry information, but sometimes for plain old amusement. A recent article with an author byline that begins "by by" did a relatively decent job of comparing J2EE and .NET with a fair bit of praise for ASP.NET, especially in the much anticipated 2.0 incarnation.

The amusement part began with the author's constant reference to ASP.NET as ASP. This is a clear and dead give away that the author has either never used both or has absolutely no pride. I will not pretend to make a comparison of ASP.NET and JSP because I really don't have any real experience with JSP. I have friends that do, and they like it well enough, and that's good enough for me to assume that you can get done what you need to get done in JSP, JSF, etc.

And there have been reams of paper and billions of bytes wasted on enumerating the differences between what is now generally referred to, by those who have been there, as "classic ASP" and ASP.NET. Let me just waste the following words for the author and my Java friends: ASP.NET IS NOT ASP. The only real thing shared between the two is the <% %> tag markers. And just for the record, ASP 2.0 was a long time ago.

ASP.NET is like the guy with Jr. following his name who just knows he turned out so much better than his dad and wonders to himself why the old man thought so much of himself that he had to go and give him the same name.

And the real ASP.NET 2.0 is just days away. I'm like a kid looking in at the candy store, just waiting for doors to open.

And no, I'm not going to give you a link to the story. Like the byline suggested, the story should go bye bye.

Absent, Still Here - Pro Now Standard

Things have been a bit crazy. Actually, more like 32 bits of crazy. At least. I registered for the VS.NET 2005 product launch with excitement. They were giving away a free copy of VS.NET 2005 Pro and SQL Server 2005 Standard. I told all my friends and they signed up with the same excitement. Then the "we made a mistake" bait-n-switch email arrived.

"...there may have been an inaccurate reference on our website when you registered..."

Come on... Who wants a Standard version when you profess to be a pro and really need the Pro version? Sorry, "edition." And yet, I'm still going.

But for those of you who would rather have all the cool stuff but can't afford the MSDN Universal subscription price, there's always Empower. If you are starting a little company (your "on the side project business") and you need tools, the best way to get them, honestly, is through the Microsoft Empower for ISVs program.

Why two links? Because it's really the best deal out there. You get media. You get download access. You get managed support newsgroups and 10 hours of advisory service. Not bad for only $375.

ONLY $375

No. I haven't bought mine yet. But I plan to. Just as soon as the chairperson of the budget committee releases the funds. My wife's a reasonable person, so I expect that to happen soon. Before the launch event in my area anyway.

It was an honest mistake I'm sure. But would it have really hurt so bad to just give out what was originally promised? It's really not a bad idea. Get all the geeks in the neighborhood to use the latest and greatest at home, and when they all go work, they'll be begging for a corporate copy so they don't have to take a step back. Let's face it, there is some way cool things in .NET 2.0. and a hundred blogs or more for each of them.

But really, Bill, don't you think the mistake would have been fortuitous? But now you just kind of look like a stingy dork--"an inaccurate reference," yeah, right. Why don't you surprise all of us still willing to come out for a standard copy and give us a pro copy as a reward for our loyalty. Now that would be cool.

Contract First Web Services with Weyer's WSCF

Yesterday I received my copy of CODE magazine with an article by Christian Weyer covering contract first web service design and his free tool WSCF (web service contract first) for Visual Studio .NET. After a few bumpy stumbles because I was reading and following examples at 2am, I got a nice example up and running.

All I can say is: TOTALLY AWESOME!

This is the way web services, especially complex services that require complete platform independence, should be built. The common [WebMethod] asmx approach in VS .NET works for small projects and quick and dirty prototypes, but to build serious web services in a service oriented architecture (SOA), you should really consider taking Christian's advice and design by schema and contract first.

Anyone building web services owes it to themselves to try this free tool.

CSS Buttons

Some time ago I was working on a web site where we wanted to have a good rollover button control for ASP.NET in our projects that would eliminate the need for client-side script. Google search turned up a post that I've since lost that discussed using CSS for rollover of a button image with all states of the button in one image.

Using CSS and custom ASP.NET controls, this little project gives you a highly useful fixed width label control and a button control with three states and automatic rollovers without having to write a single line of javascript and without having to manage multiple image files for one button.

The FixedWidth label uses a CSS button and a little GDI+ to measure the length of the label text and truncate the text if necessary to fit it within the specified width. It then adds an elipsis button (you control the button as well) to which a javascript alert with the full string is hooked.

Download the source code and use these controls as you will. In it you'll find the control project and a test/example project to show you how to use it. If you find it useful and/or make changes/improvements to it, I'd love to hear from you and see what you've done with it.

CssWebControls.zip (45.1 KB)

What About Me

I am a .NET developer and architect with more years in the software industry than I care to admit, the last seven of which have been spent architecting and implementing web and rich client applications for the enterprise. For the last four years I have worked nearly exclusively in C#.

I jumped into C# in 2001 when I read Borland's lawsuit against Microsoft over the fact that Bill had lured many key people away from Borland (all's fair in love and war, no condemnation here) to work on what was the precursor to .NET and C#. That's where I first learned of Anders Hejlsberg. I was already a Delphi enthusiast and reading about Anders journey north got me very interested in what he had produced.

At the time, I was considering moving away from Delphi and into the J2EE world. I consulted with a friend who was already a very successful consultant in that space. He read the winds blowing in from the northwest and suggested I would be better off, in terms of job opportunities in the future, if I went with C# and .NET. I haven't looked back since. I do look over the fence at J2EE from time to time to see what's happening but I don't think you could get me to switch from Diet Coke to coffee.