PDA

View Full Version : javascript calls webservice service error


SYMBIO
01-21-2004, 04:46 PM
i dont really want the error "service is undefined" to pop up or even have an error....

here is my syntax>>



<script language="JavaScript">

function init()
{
service.useService("webservices.asmx?WSDL","HelloWorld");
}
</script>

onload="init()"

<%

Service1 one = new Service1();
Response.Write(one.HelloWorld());

%>

-----------------
[WebMethod]
public string HelloWorld()
{
"This is content coming from a webservice ASMX file.";
}
-----------------


thing is...it works...but i get the error 'service' is undefined.

is there something im doing thats wrong? is there a better way of using webservices?

glenngv
01-22-2004, 07:13 AM
It means you have not defined the javascript variable service. I see that it's some kind of an object with the method useService().
Somewhere in your code you should have something like:

function Service()[
this.someProperty = 1;
this.useService = new function(){
...
}
}
var service = new Service();


On the other hand, I'm also suspecting that you're trying to interact javascript with VB.NET. You can't interact client-side (javascript) and server-side (VB.NET) like that. The server-side code is executed on the server and generates html and javascript that the client renders and executes respectively.
Please post some other codes to see the whole picture.

SYMBIO
01-30-2004, 12:42 PM
cheers, i have it working now.