I have only just come across htc files over the last couple of days (Hyper Text Components). These are essentially controls that extend the DOM for a page. The controls must be referenced in container – which has a style attribute set to e.g. “BEHAVIOR:url(webservice.htc)”.
Note that general, two functions need to be used when using the ht component – 1. to start the call to the webservice / instantiate the htc stuff and 2. a callback function that processes the returned information.
The reason for looking into htc files is that they seemed to correctly pass credentials through to the webservice (there were perms problems with ntlm auth when trying to call the webservice using simpler ajax stuff – as credentials seemed to be passed through as plain text).
Note that I believe that these only work in IE >5.
//Set up the service call and set to async.
document.all("divWS").WebServiceMethodName.async = false;
serviceReturn = document.all("divWS").WebServiceMethodName.callService(WebServiceCallback,"WebServiceMethodName", id);
var xfaultcode = result.errorDetail.code;
var xfaultstring = result.errorDetail.string;
var xfaultsoap = result.errorDetail.raw;
alert("ERROR:" + " c=" + xfaultcode + " s=" + xfaultstring + " soap=" + xfaultsoap);
document.getElementById("resultDiv").innerHTML = result.value;
Results will be shown in here
<div id="divWS" style="BEHAVIOR: url(/_layouts/1033/webservice.htc)"></div>