C
Cam
I am running into a problem with trying to use web services in a web
page. As an example I created a C# web service using the VS 2003
wizard, the only change I made was to remain the namespace and service
and uncomment the "HelloWorld" method. I compiled and tested this
using "SimpleService.asmx" file as my start page, which creates the
standard web page to invoke the service. This all works fine.
So now I want to use the service in a web page using the WebService
Behavior script and this is where I am running into trouble. The html
is pasted below
===================================================================
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>SimpleService Test Page</title>
<script language="JScript">
var iCallID = 0;
fucntion Initialize()
{
//Create an instance of the web service and call it SimpleService
service.useService("http://localhost/SimpleService/SimpleService.asmx?WSDL","SimpleService");
// Call the HelloWorld method
iCallID = service.SimpleService.callService(DisplayResults,
"HelloWorld);
}
function DisplayResults(result)
{
if(result.error)
{
var xfaultcode = result.errorDetail.code;
var xfaultstring = result.errorDetail.string;
var xfaultsoap = result.errorDetail.raw;
alert("Webservice call failed\nFaultcode = " + xfaultcode +
"\nFaultstring = " + xfaultstring + "\nFaultsoap = " + xfaultsoap);
}
else
{
alert("Webservice call success: " + result.value);
}
}
</script >
</head>
<body onload="Initialize()">
<div id="service" style="behavior:url(webservice.htc)"></div>
</body>
</html>
===================================================================
So when this page loads it should call the method and display the
returned value. What I am getting is an error where the values are
Faultcode = Client
Faultstring = Service unavailable
I have tried using the actual path to the web service in the useService
call as per Microsoft docs but this still fails. I haven't resorted to
using a Windows Form to test the service as I need to access the
services via a web browser.
I've searched the web etc. but cannot find any solution. Can anyone
help me out here.
Cheers
Cam
page. As an example I created a C# web service using the VS 2003
wizard, the only change I made was to remain the namespace and service
and uncomment the "HelloWorld" method. I compiled and tested this
using "SimpleService.asmx" file as my start page, which creates the
standard web page to invoke the service. This all works fine.
So now I want to use the service in a web page using the WebService
Behavior script and this is where I am running into trouble. The html
is pasted below
===================================================================
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>SimpleService Test Page</title>
<script language="JScript">
var iCallID = 0;
fucntion Initialize()
{
//Create an instance of the web service and call it SimpleService
service.useService("http://localhost/SimpleService/SimpleService.asmx?WSDL","SimpleService");
// Call the HelloWorld method
iCallID = service.SimpleService.callService(DisplayResults,
"HelloWorld);
}
function DisplayResults(result)
{
if(result.error)
{
var xfaultcode = result.errorDetail.code;
var xfaultstring = result.errorDetail.string;
var xfaultsoap = result.errorDetail.raw;
alert("Webservice call failed\nFaultcode = " + xfaultcode +
"\nFaultstring = " + xfaultstring + "\nFaultsoap = " + xfaultsoap);
}
else
{
alert("Webservice call success: " + result.value);
}
}
</script >
</head>
<body onload="Initialize()">
<div id="service" style="behavior:url(webservice.htc)"></div>
</body>
</html>
===================================================================
So when this page loads it should call the method and display the
returned value. What I am getting is an error where the values are
Faultcode = Client
Faultstring = Service unavailable
I have tried using the actual path to the web service in the useService
call as per Microsoft docs but this still fails. I haven't resorted to
using a Windows Form to test the service as I need to access the
services via a web browser.
I've searched the web etc. but cannot find any solution. Can anyone
help me out here.
Cheers
Cam