Hello all,
We have an app built on .net 2.0 that makes use of xml web services on the backend and we have a thin windows client on the front-end. The windows client makes use of the new web browser control. Through this control we makes calls to the windows client code which in turn makes calls to the web services and display the formatted info to the user.
All of these calls are being made through client side javascript on the client HTML. Using window.external.MethodCall(), the HTML elements make calls on the client code methods which in turn call the webservices webmethods.
Now we are looking at making a web client (instead of a windows client) that runs on the browser. How can I re-use the client code to the most the window.external calls wont work even after loading the dll into the bin folder of the web app.
Thanks

Calling javascripts written for windows client from a web client
phoenix_13
Do you really need to call the WS from JS
If no, I would recommend to call the WS not from JS, but using managed code (C#, VB.NET) in the code-beside or any other classes.
Using this object oriented approach is always better in terms of reusability and modifiability than using JS.
Rgds,
Rodrigo
Matty1stop
There are a few method you *could* do, however the complexity of the work to build a solid code base for accessing web services via client-side code is quite large.
1. There is a webservice.hta file floating around (i think from Microsoft) for calling web services, however browser compatibility is limited.
2. If your web services are fairly simple you can construct calls via xmlhttp:
<script language="javascript">
var xmlhttp = null;
function Invoke()
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "http://server/service.asmx/method_name", true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4)
{
alert(xmlhttp.responseText);
}
};
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("param1=value1¶m2=value2");
}
</script>
3. You can use construct SOAP xml to send the data to the service for complex services.
HTH,
- Justin Thomas