Thursday, October 24, 2002

A grab bag of things today.
  • In a .NET SOAP client, when you pass null for a String parameter, the client simply omits that parameter. On the server side, a .NET server marshalls this as null. In GLUE, if you pass null for a parameter, GLUE includes the parameter but marks it with the xsi:nil='1' attribute. However, .NET marshalls this as an empty string. Haven't looked at Axis yet.
  • GLUE has a way of handling SOAP headers which I thought was pretty clunky at first, but I kind of like it now. Basically, you write a separate class, attach that to an electric.util.Context object, and then pass that in on the electric.registry.Registry.bind() call. I like .NET's approach of automatically marshalling that into members on the target object, too bad that doesn't work all the time.
  • The PreAuthenticate property on .NET's System.Web.Services.Protocols.SoapHttpClientProtocol is supposed to force the SOAP client proxy to send credentials with the first request, rather than doing the challenge/response exchange. If you add the following code to your SOAP Client proxy, you can make PreAuthenticate work (this example is for basic authentication):
     
    protected override System.Net.WebRequest 
    GetWebRequest(Uri uri) {
    System.Net.HttpWebRequest request =
    (System.Net.HttpWebRequest)base.GetWebRequest(uri);
    if (this.PreAuthenticate) {
    System.Net.NetworkCredential nc =
    this.Credentials.GetCredential(uri,"Basic");
    if (nc != null) {
    byte[] credBuf =
    new System.Text.UTF8Encoding().
    GetBytes(nc.UserName + ":" + nc.Password);
    request.Headers["Authorization"] =
    "Basic " + Convert.ToBase64String(credBuf);
    }
    }
    return request;
    }
    Note that if you do this, you don't want to regenerate your web references in VS.NET, or via WSDL.EXE, or you'll need to add this code again. Actually, it's better to just move a customized proxy out of the VS.NET web references folder.
  • Mindreef's Tide is rapidly becoming a tool I can't live without. What I love is that I can run a proxy server on my machine, and whenever anybody comes asking why their request doesn't work, I just have them route it through Tide and look at the trace that flows through. Any tool that lets me stay in my chair more is a beautiful thing.
5:45:26 PM  permalink Click here to send an email to the editor of this weblog. 


Stories
DateTitle
1/23/2003 Why XML?
8/13/2002 Resolution for IE and Windows problems
8/10/2002 Supporting VS.NET and NAnt
5/11/2002 When do you stop unit testing?
Contact
jabber: weakliem
YM: gweakliem
MSN: gweakliem@pcisys.net
email: Click here to send an email to the editor of this weblog.
Subscribe to "Gordon Weakliem's Weblog" in Radio UserLand.
Click to see the XML version of this web page.