views:

63

answers:

0

Hi,

i am trying to call a webservice by using the IE's WebService behaviour object. As describen in the JS book book, I have inserted my div element:

<div id="service" style="behaviour(webservice.htc)" onresult="onWebServiceResult()">

And I have my js globals and function:

<script type="text/javascript">

    var iCallId = -1;
    var sWSDL = "http://staff.um.edu.mt/cabe2/supervising/undergraduate/owlseditFYP/TemperatureService.wsdl";

    function getTemperature(sTemperature)
    {
        var oWebService=document.getElementById('service');
        oWebService.useService(sWSDL,'Temperature');
        iCallId = oWebService.Temperature.callService('getTemp',sTemperature);
    }

    function onWebServiceResult()
    {
        var oResult = event.result;
        if(oResult.id==iCallId)
         {
         if(oResult.error)
          {
          alert('Error occured: '+oResult.errorDetail.string);
          }
         else
          {
          alert('Response value: '+oResult.value);
          }
         }
    }

</script>

when I run the code and call the getTemperature function, I get an error saying:

"Microsoft JScript runtime error: Object doesn't support this property or method"

I have a feeling I do something wrong in

 <div id="service" style="behaviour(webservice.htc)" onresult="onWebServiceResult()">

My webservice.htc file is under the root; the same place with my .aspx page where I do the above calls.

Does anybody have experience with this?

Thanks,

burak ozdogan