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.
|
|