Wednesday, March 28, 2012

calling a web service from a secure site

I have hooked into a web service from our site and it has worked fine throughout development. Now that we've pushed the site live, the page that calls the service is a secure page and I get a javascript error on a line 3210. I'm assuming it's in the Atlas.js file (since I'm using Atlas to call the web service). That line says

_requestor.open('POST', _effectiveUrl,true);

I'm not sure what to do to fix this or if it's possible to fix it since I'm calling it from a secure page. Has anyone run into anything like this before and if so, how do you get around it? Or is it impossible to call an unsecure web service from a secure page? Thanks.

The browser generally limits calls from secure to unsecure pages. Is there any way you can put the web service on the same secure site?

thanks,
David


I'm having almost the same problem... the only difference is that the page is not a secure page...


Well, the service the page is calling is located on the same secure domain as the secure page. And in the atlas:ServiceReference Path, I specify the full secure url. It is in this service on the secure site that it calls the unsecure service. So, I would think that the browser wouldn't really know anything about the unsecure service since it's only calling a secure service. Unfortunately the unsecure service is not mine and I have no way to secure it. Is there any other type of work around for this? Thanks.

So if I understand correctly:

Your page in on the secure server. e.g.https://www.srv.com/app/page.aspx
Yes, you've got it. That's exactly how it's set up. The secure page calls a web service through Atlas on the same secure server. That service has a web reference set up to a non secure service. That's what I was afraid of, but I'm not sure then why it works if I go to the page as an unsecure url.

But where is the failure point? I assume that the call from Javascript to the secure server is correctly happening, and that it is the second call to the non-secure service that is failing?

If so, I would think this would happen without Atlas in the picture. e.g. if you make the same non-secure call from your page's Page_Load() method, does it fail in the same way?


Unfortunately because this is not on a my local box, I can't do any real step through debugging, but according to the error message, it looks like it's occurring in the atlas javascript call to the 1st (secure) service in atlas.js, line 3210, _requestor.open('POST', _effectiveUrl, true);.
I just tried something and found something interesting. I modified the atlas.js file and put an alert right before the line that's erroring with the url of the service it's trying to call. Even though I setup the serverreference path ashttps://secure..., when it alerts, it's coming back ashttp://secure... When I view source, the reference is still there as https, so I'm not sure why atlas is treating it as http. Maybe I'll have to just redo this in traditional ajax and forgo the Atlas handling.

No comments:

Post a Comment