
May 25th, 2002, 10:12 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
Please help me!About Webservice Behavior
<i><b>Originally posted by : wuzixin (wuzixin@95777.com)</b></i><br />Please take a look at the code below.It is about "webservice behavior".<br /><br />When I run it,it return the error string: Invalid argument <br /><br />The two files and "webservice.htc"is put in the same directory.<br /><br />whether "math1.asmx?SDL" should be ¡°?WSDL¡± or ¡°?SDL¡±<br /> If I type ?WSDL,the error string is "service unavailable".<br /><br />If I use WebserviceUtil.exe to make a proxy and use it in .aspx file,everything is OK.<br /><br />Moreover,I copy the sample(add two number) in the article "Using Webservice Behavior" in the MSDN,then I found it has the same problem.<br /><br />If you know the answer,please email to me:wuzixin@95777.com Thank you very much!!!<br /><br />filename£ºmath1.asmx <br /><br /><%@ WebService Language="C#" class=MyMath %> <br />using System; <br />using System.Web.Services; <br />public class MyMath : WebService { <br /> [WebMethod] <br /> public string add() <br /> { <br /> return "kk"; <br /> } <br />} <br /><br />filename£ºtest1.htm <br /><br /><script language="JavaScript"> <br />var iCallID = 0; <br />function init() <br />{ <br /> service1.useService("math1.asmx?SDL","MyMath1"); <br /> iCallID=service1.MyMath1.callService("add"); <br />} <br />function onWSresult() <br />{ <br /> if((event.result.error)&&(iCallID==event.result.id)) <br /> { <br /> var xfaultcode = event.result.errorDetail.code; <br /> var xfaultstring = event.result.errorDetail.string; <br /> var xfaultsoap = event.result.errorDetail.raw; <br /> alert(xfaultstring); <br /> } <br /> // if there was no error, and the call came from the call() in init() <br /> else if((!event.result.error) && (iCallID == event.result.id)) <br /> { <br /> // Show the arithmetic! <br /> alert(intA + ' + ' + intB + ' = ' + event.result.value); <br /> } <br /> else <br /> { <br /> alert("Something else fired the event!"); <br /> } <br />} <br /></SCRIPT> <br /><body onload="init()"> <br /><div id="service1" style="behavior:url(webservice.htc)" onresult="onWSresult()"> <br /></div> <br /></body> <br /><br />
|