Sending the Browser Certificate to an https SharePoint Web Service when using SPServices and jQuery

StackOverflow https://stackoverflow.com/questions/13844363

I am writing some JavaScript to communicate with a SharePoint Web Service that resides behind a firewall and requires a certificate.

I have the right certs installed in my browser. When I browse over to the WSDL I load the page just fine.

But when I execute a simple SPServices command (GetListCollection) from a web page using javascript/jQuery, I get an unauthorized error.

I removed the certs from my browser and tried to load the WSDL and got the exact same error. Reinstalling the certs fixes the WSDL view, but my JavaScript still errors out.

I am using this code:

$().SPService({
  webURL:  [the url],
  operation: "GetListCollection",
  async: false,
  completefunc: function( xData, Status ) {
    console.log( 'Status: ' + Status );
    if ( !!xData ) {
      $( xData.responseXML ).find("Lists > List").each(function() {
        var $node = $(this);
        console.log( $node.attr( "Title" ) );
      });
    }
    else {
       alert('Null result.');
    }
  }
});

Sorry if there are typos in the code; this is not cut and paste because my dev box is not connected to the internet.

I think I need to embed a certificate that is installed in the browser (of whoever is running the code on my page) into the web service request, but I have no clue how or where to look for the answer. Any tips would be greatly appreciated.

有帮助吗?

解决方案

Turns out you are not allowed to talk to any other servers via https using javascript other than the server you loaded the original page from. It is part of the ajax/javascript security spec. So this solution will not work at all. I'll have to look into a server-side proxied request solution.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top