IE8 WebService Behaviour Issue

D

Dave Young

We're using the WebService behaviour in one of our intranet applications,
it's been working fine under IE5 -> IE7. Looking at upgrading browser to IE
8 and found that the web service behaviour is no longer working using that
browser. The useService method is throwing an exception "Object doesn't
support this propery or method. both the htc file and the
WorkQueue_svc.asmx file are located in the same directory as the calling
page. I've tried calling it both with and without the "?WSDL" parameter.
I'm hoping someone can share some insight.

Here's a code snippet:

<script language=javascript>
function loadService()
{
try
{
pagebody.useService("WorkQueue_svc.asmx?WSDL","WorkQueueService");
pagebody.WorkQueueService.onserviceavailable = LoadQueries;
}
catch (e)
{
alert("Cannot find web service WorkQueue_svc.asmx.");
}
}
</script>

<body id="pagebody" style="BEHAVIOR: url(webservice.htc)"
onload="loadService();">
 
P

Patrice

What is loadService is called from a button click ?

Not a fan but I noticed that the behavior is defined using a style and
 
D

Dave Young

It's called in the page onload.

Like I said, this has been working and currently is working using IE7 and
below. But, using IE8, even in compatibility mode, throws the javascript
error.
 
P

Patrice

Oops, sorry, for the previous post...

Never used them but I would try to define the behavior on an inner element
and to trigger its use from a button click just to see what happens.

My warning radar tells me it could be some kind of timing issue such as
having the load event being fired before the htc script is loaded (and I
remember to have seen that loading scripts in IE8 was optimized perhaps
producing some timing issue not found in earlier releases)...
 
D

Dave Young

Looks like it's definately a timing thing. I guess with the optimization
you were speaking about, the order of how scripts are loaded and run in
relationship to the DOM has changed a bit.

I was able to get it to work by removing the script that initializes the web
service from the body onLoad event handler. I added a window onload event
handler and put it there, Everything is golden now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top