Strange Bug in ASP.NET Sample SOAP request/response generation

I encountered a strange bug in how ASP.NET generates sample SOAP
request/responses in .NET 1.1 (this may be the case on 1.0 as well – haven’t
tested). Take a look at this very simple web service, that includes a header:

using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
namespace TestHeaderWS {
    public class MyHeaderType: SoapHeader {
        public System.Xml.XmlElement AnyThing;
    }
    public class TestHeaderService: System.Web.Services.WebService { [WebMethod][SoapHeader("MyHeader")][
        return: XmlElementAttribute(Namespace = "")] public string DoSomething() {
            return null;
        }
        public MyHeaderType MyHeader;
    }
}

Now point your browser to http://localhost/TestHeaderWS/TestHeaderService.asm
x
, select the
DoSomething operation, and take a look at the sample SOAP request displayed.
You should see something like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <MyHeaderType xmlns="http://tempuri.org/">
            <AnyThing>
                <DoSomethingResult xmlns="">
                    <string>string</string>
                    <string>string</string>
                </DoSomethingResult>
                <string xmlns="">string</string>
            </AnyThing>
        </MyHeaderType>
    </soap:Header>
    <soap:Body>
        <DoSomething xmlns="http://tempuri.org/"/>
    </soap:Body>
</soap:Envelope>

Notice how messed up the sample response is – for some reason, it is embedding
what actually is the result XML (DoSomethingResult) in the header. There are
two triggers to cause this bug (fyi, the service appears to actually work
properly, so this isn’t a big deal).

  1. There needs to be a header with generic XmlElement member.
  2. There needs to be a return: attribute on the operation that has an empty (“”) namespace qualifier. Change this namespace to “foo”, and you’ll see the proper sample response. Strange.

Spring Camping at Devils Lake

We took the short trip to Lincoln City, OR this
weekend for some yurt camping at
Devils Lake. Tent camping in
the spring in Oregon is always a risk (unless you like lying in mud), so
rather than stay home we’ve started exploring the various state parks that
offer yurts
. Hardly roughing
it, but we still cook outside, make s’mores by the campfire, and explore the
waterways in our canoe. I also took some pictures
with my new Nikon Coolpix 2500 digital camera.

Devils Lake was much more interesting than I expected. The fishing was great –
we landed 6 decent size hatchery rainbows (all catch and release with the
exception of one poor guy that didn’t survive a hook swallow – we gave him to
our camping neighbors).

First Time with Fresh Fish

I received my copy of Fresh
Fish
from Plenary
Games
on Saturday and got a chance to play it
for the first time tonight. Julie humored me with a quick 2-player game. I’ll
do a more thorough review shortly, but I have to say that I can’t wait to play
this with 3 or 4 players. Fresh Fish is a tile placement game with a small
auction element and a big puzzle/deduction element. The rules are very simple,
but I can see the strategies being quite complex. This game only took about 15
minutes to finish; I would guess that each additional player would add 10-15
minutes.