Hi All,

I have just converted a few projects (Web Application, Web Service) to .Net 2005. The web application calls the web service using javascript from the client side.

I am getting Error 401 - Unauthorized Access. I understand how to get around this error on the server side (i.e. PreAuthenticate and set credentials to default credentials), but can't seem to get it working client-side.

Unfortunately, I cannot move this code to the server side - my dev manager wants it where it is.

Here is the javascript call:

PBService.useService("http://MyServer/PBWebservice/PBWebservice.asmx?WSDL","retVal");

PBService.retVal.callService(ParseXML, "MyFunction", document.getElementById("cnn").value, ID);

where cnn and ID are being passed to the web service as parameters.

Thanks for your help,

Rachel

PBService seems to be a server side component and if so, you will not be able to use it in a javascript.

Instead you can use the XMLHttpRequest with javascript (AJAX to be precise) object to post date to your webservice and parse the response.

Search for XMLHttpRequest and you will get tonnes of code samples.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.