Web service fra Java til VB.Net
Hej er der nogle der kan hjælpe med at conveterer denne kode til brug i ASP.NET VB script<!-- eventhandling-functions -->
<script type="text/javascript">
// Indicates the timeout (in msec) until the next "GetValues"-method is called
var nRefreshTimeout = 2000;
// called when initalized
function Loader()
{
// initializes the WebService-communication
body.onserviceavailable = enableServiceCall();
// insert the URL of the WebService-WSDL-file and the name you want to use below
body.useService("../TcMCE_Sample.asmx?wsdl","WebServiceSample");
// starts the "GetValues"-loop
GetValues_Request();
}
// is needed for correct WebServcie-handling
function enableServiceCall(){}
function GetValues_Request()
{
// asynchronous call of the WebService-method "GetValues" with no parameter-values
// the result is sent to the "GetValues_Result" function
iCallID = body.WebServiceSample.callService(GetValues_Result, "GetValues", "");
}
function GetValues_Result(res)
{
try
{
if(res.error)
{
alert(res.errorDetail.string);
}
else if(res.value["GetValuesResult"] == false)
{
alert("WebService-Error!");
}
else
{
// Getting and displaying the new values
lblLight1Value.innerText = res.value["arrLightValues"][0];
lblLight2Value.innerText = res.value["arrLightValues"][1];
lblCounterValue.innerText = res.value["nCounterValue"];
lblSensor1Value.innerText = res.value["nSensor1Value"];
lblSensor2Value.innerText = res.value["nSensor2Value"];
lblSensor3Value.innerText = res.value["nSensor3Value"];
lblSensor4Value.innerText = res.value["nSensor4Value"];
lblSensor5Value.innerText = res.value["nSensor5Value"];
lblSensor6Value.innerText = res.value["nSensor6Value"];
lblSensor7Value.innerText = res.value["nSensor7Value"];
lblSensor8Value.innerText = res.value["nSensor8Value"];
lblSensor9Value.innerText = res.value["nSensor9Value"];
lblSensor10Value.innerText = res.value["nSensor10Value"];
// loop-timeout
window.setTimeout("GetValues_Request()",nRefreshTimeout);
}
}
catch(e)
{
if (e.description == null)
{
alert("Error : " + e.message);
}
else
{
alert("Error : " + e.description);
}
}
}
</script>