Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

'Permission denied' error while using https request in the javascript's Microsoft.XMLHTTP open() function.

Hi all,

I have written a http based RPC server. And I am trying invoke one of the RPC methods in a javascript using XMLHTTP.
I am able to do it when making using http requests.
But with https, it fails due to "permission denied" error.

oHttp = new ActiveXObject("Microsoft.XMLHTTP");
oHttp.open("POST", "https://localhost:383/com.ov.jmc.ovjmc", false);

oHttp.open is the function throwing this error when the uri contains https.

I have imported the proper certificates in my browser, and the normal https request looks working through browser.

Please help me solving this problem asap..

Regards
Sathish
0
sathishpy
Asked:
sathishpy
  • 3
  • 2
1 Solution
 
ZylochCommented:
Hi

Hmm... That is odd. You can have this:

oHttp = (document.all) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
oHttp.open("POST", "https://localhost:383/com.ov.jmc.ovjmc", false, username, password);
oHttp.send();
if (oHttp.readyState==4) {
   echo(oHttp.status+"\n");
   echo(oHttp.responseText);
}



Regards,
Zyloch
0
 
sathishpyAuthor Commented:
Hi Zyloch,

Thanks for your resply...But my problem is not fully solved....
I included your code. Now it is not giving 'permission denied' error. Still I am not getting the response like my http request.
Also my RPC Server doesn't require any authentication. Only a valid certificate is enough to access the method. In that case what should I mention in username and passwd field. If I put empty string there, again I am getting the same error.

Regards
Sathish
0
 
ZylochCommented:
The empty string should work, or you could just omit it and use oHttp.open("POST", "https://localhost:383/com.ov.jmc.ovjmc", false);

You could try changing the false to true and see what happens. You can also include this to test:

document.write(oHttp.status+"\n");     //Sorry about the echo(). I was thinking PHP by accident
document.write(oHttp.responseText);

0
 
sathishpyAuthor Commented:
Don't know what is happening...

try
{
   oHttp.open("POST", "http://localhost:383/com.ov.jmc.ovjmc", false);
}
catch(e)
{
    alert("Error Name:"+e.name);
    alert("Error message:"+e.message);
}
This always runs without any problems...

   oHttp.open("POST", "https://localhost:383/com.ov.jmc.ovjmc", false);
   oHttp.open("POST", "https://localhost:383/com.ov.jmc.ovjmc", true);
   oHttp.open("POST", "https://localhost:383/com.ov.jmc.ovjmc", false,"","");
All these are throwing the exception with
Error Name:Error
Error Message:permission denied

   oHttp.open("POST", "https://localhost:383/com.ov.jmc.ovjmc", false,"temp","temp");
This will not throw any error, but with this oHttp.send is throwing an error having no message.

Any idea what happens exactly when oHttp.open is called? Will it send the certificate during this call or it is sent while calling oHttp.send() is called?
0
 
ZylochCommented:
I'm not too sure as I've not used this often, it could be because https is restricted to only your domain, because most Permission or Access Denied errors result from cross domain calling when it's not allowed.

Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now