I am trying to call my BMI webservice to a html page which calculates and return the result, I have the following code but it is not working.

   <title>Body Mass Calculator</title>
    <script language="JavaScript">
     function InitializeService(){
     var doubleFeet, doubleInches, doubleWeight;
     function GetBMI(){
      doubleFeet = document.DemoForm.doubleFeet.value;
      doubleInches = document.DemoForm.doubleInches.value;
      doubleWeight = document.DemoForm.doubleWeight.value;
      service.BMI.callService("GetBMI", doubleFeet, doubleInches, doubleWeight);
     function ShowResult(){
     <body onload="InitializeService()" id="service" 
	style="behavior:url(webservice.htc)" onresult="ShowResult()">
      <form name="DemoForm">
       Feet : <input type="text" name="doubleFeet"/>
       Inches : <input type="text" name="doubleInches"/>
       Weight : <input type="text" name="doubleWeight"/>
       <button onclick="GetBMI()">Get BMI</button>
6 Years
Discussion Span
Last Post by tinymark

This is the line you are using to connect to the service.

service.useService(http://localhost:57955/BMI.asmx, "BMI");

Try this one.

service.useService(http://www.beetledev.com/webservices/bmiservice.asmx, "BMI"

This is your code.
service.BMI.callService("GetBMI", doubleFeet, doubleInches, doubleWeight);
This is from Microsoft.

iCallID = sElementID.sFriendlyName.callService( [oCallHandler], fo, oParam)
sElementID	 Required. The id of the element to which the WebService behavior is attached.
sFriendlyName	 Required. The friendly name for the Web Service, which is defined by calling the useService method.
oCallHandler	 Optional. The name of a script callback function that handles the results returned from this instance of the method call.
fo	 Required. One of the following possible values.
A String representing the name of the remote function being called. The String must be bounded by single or double quotation marks.
A call object, which has the necessary properties defined to call a remote function.
oParam	 Required. One or more comma-delimited parameters, which are passed to the method name specified by fo.

Look at the args you are calling with and compare them to what Microsoft says. Clean this up and I think everything will work.

Edited by tinymark: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.