Beste,
ik zou graag een webservice aanroepen vanuit html en javascript.
Op de site van msdn heb ik het voorbeeld bekeken en mijn code ook op die manier geschreven. Maar blijkbaar gebeurt er niet, geen foutmelding, geen resultaat, totaal niets.
Bovenstaande code zou mijns inziens moeten werken. Maar doet het dus niet, ziet er iemand een probleem?
ik zou graag een webservice aanroepen vanuit html en javascript.
Op de site van msdn heb ik het voorbeeld bekeken en mijn code ook op die manier geschreven. Maar blijkbaar gebeurt er niet, geen foutmelding, geen resultaat, totaal niets.
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Test HelloWorld</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="gadget.js" type="text/javascript"></script>
<SCRIPT language="JavaScript">
// All these variables must be global,
// because they are used in both init() and onResult().
var iCallID = 0;
function init()
{
// Establish the friendly name "HelloWorld" for the WebServiceURL
service.useService("/Webserver/build.asmx?WSDL","HelloWorld");
// The following uses a callback handler named "mathResults"
iCallID = service.HelloWorld.callService(HelloWorldFunction, "sayHelloWorld");
}
function HelloWorldFunction(result)
{
// if there is an error, and the call came from the call() in init()
if(result.error)
{
// Pull the error information from the event.result.errorDetail properties
var xfaultcode = result.errorDetail.code;
var xfaultstring = result.errorDetail.string;
var xfaultsoap = result.errorDetail.raw;
alert("Error found!!");
}
// if there was no error
else
{
// Show the result
alert(result.value);
}
}
</SCRIPT>
</head>
<body onload="init()">
<!-- this div is showed when docked -->
<div id="HelloWorldDocked">
<h1 class="docked">Test Hello World</h1>
<h1 class="docked"> Undock the gadget to test </h1>
</div>
<!-- this div is showed when undocked -->
<div id="HelloWorldUnDocked">
<p> This gadget will show the " Hello World String "</p>
<p> It will only work when it is undocked </p>
<div id="service" style="behavior:url(webservice.htc)"> </div>
</div>
</body>
</html>
Bovenstaande code zou mijns inziens moeten werken. Maar doet het dus niet, ziet er iemand een probleem?
Laatst bewerkt: