I've created a WCF service that I'm attempting to use for a cross-domain call (using jQuery and JSONP). I've written the service and when I run it in the Visual Studio debugger and call it from a test page on my local PC it works fine. When I deploy the service to IIS7 on our server, it doesn't work. Looking at it with Fiddler, I see there's a 400 error coming back.
This is my first attempt at creating a WCF service and also my first attempt at JSONP, so it is highly possible I've missed something simple yet important.
I have 2 methods on this service, one really simple one (called GetData) which just takes a string and returns it - I created this one just to test the basic service functionality (i.e. I can just put the URL into a browser and I get some json back) and it works OK.
The other, problematic, one (called GetMatter) takes a couple of parameters, calls another (SOAP) web service to get some data and returns a Stream containing the call to my callback function. This then gets inserted into the calling page which displays the result.
The contract looks like this:
[ServiceContract]
public interface IOracleService
{
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "getData/{value}")]
string GetData(string value);
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "getMatter/{matterId}/{callback}")]
Stream GetMatter(string matterId, string callback);
}
The implementation looks like this:
public class OracleService : IOracleService
{
public string GetData(string value)
{
return string.Format("You entered: {0}", value);
}
public Stream GetMatter(string matterId, string callback)
{
//call web service
var serviceResult = <call to web service goes here>;
//serialize data to json
JavaScriptSerializer js = new JavaScriptSerializer();
string jsonResult = js.Serialize(serviceResult.data);
jsonResult = jsonResult.Substring(1, jsonResult.Length - 2);
string result = callback + "(" + jsonResult + ");";
return new MemoryStream(Encoding.UTF8.GetBytes(result));
}
}
My simple Test.html page looks like this (for the purposes of this test, the js file is just stored on my local Q: drive):
<html>
<head>
<script src="./jquery-2.2.2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="output"></div>
<div id="output2"></div>
<script language="javascript">
var url = "Q:\TestService.js";
var script = document.createElement("script");
script.setAttribute("src", url);
script.setAttribute("type", "text/javascript");
document.body.appendChild(script);
</script>
</body>
</html>
TestService.js is as follows (note that Service.Legal is the namespace that OracleService is defined in, and MyServer is the name of the server that I've deployed the service to. When running in the debugger, MyServer is changed to "localhost:portnumber" and this works OK then)
var url = "http://MyServer/Service.Legal.OracleWebService/OracleService.svc/GetData/1";
url += "?" + new Date().getTime().toString(); //append time to prevent caching
var script = document.createElement("script");
script.setAttribute("src", url);
script.setAttribute("type", "text/javascript");
document.body.appendChild(script);
function ServiceCallback(data) {
console.log("got data: ");
console.dir(data);
var result = data;
var date = new Date(parseInt(result.INVOICE_DATE.substr(6)));
var output = "<ul>";
output += "<li>INVOICE DATE: " + date + "</li>";
output += "<li>TOTAL EXCL GST: " + result.TOTAL_EXCL_GST + "</li>";
output += "<li>FEE ESTIMATE: " + result.FEE_ESTIMATE + "</li>";
output += "</ul>";
$("#output").html(output);
}
Finally, the web.config looks like:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webHttpBinding" crossDomainScriptAccessEnabled="true">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<client />
<services>
<service name="Service.Legal.OracleWebService.OracleService">
<endpoint address="" binding="webHttpBinding" contract="Service.Legal.OracleWebService.IOracleService" behaviorConfiguration="webBehaviour" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://MyServer/Service.Legal.OracleWebService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type, Accept" />
</customHeaders>
</httpProtocol>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
<httpErrors errorMode="Detailed" />
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
As I said above, when I run this service in the Visual Studio debugger, my html page runs the javascript in TestService.js, the javascript calls my service (http://localhost:15021/OracleService.svc/GetMatter/matterId/ServiceCallback) and I end up with the expected data being displayed on the page.
When I change that service url to point at the server (http://MyServer/Service.Legal.OracleWebService/OracleService.svc/GetMatter/matterId/ServiceCallback), I get a blank page and Fiddler shows the request giving error 400.
A basic test of the web service directly in the browser
http://MyServer/Service.Legal.OracleWebService/OracleService.svc/getData/1
does return the expected json data (although obviously IE just asks if I want to open or save "1.json", it doesn't display anything in the browser), so the service itself does appear to be accessible and working OK in IIS. There just seems to be something wrong with my GetMatter function or the way I'm calling it that is preventing it from working on the server.
Hmm OK never mind, I think I was looking at the wrong problem.
The 400 (bad request) error made me think the problem was with the call to my web service. But it seems the problem is actually happening on the server side when my web service tries to call the other web service. When I took out that call to the other web service, my service returned a 200 (success) instead. I'm going to work on the assumption that what I've got (as posted above) is OK, and the issue is something to do with the call to the other web service. Perhaps a firewall issue that is preventing the call going from my server to that server, while allowing it to go from my development machine to the same server.
Related
I am making an android app and doing pretty well atm. What I want is when a user presses a url with variable search parameters attached to it, that the entire url is sent to my app.
The app opens well, but I don't know how to get the search parameters in there as well.
Btw. the app has a webview of the internet page in it, which works fine. I am opening the app itself as well as clicking on the links sent to whatsapp and messenger from within my app.
E.g. the url could be https://www.sendamap.com/index.php?g=100&z=200
Standard the https://www.sendamap.com is opened. I would like the whole url to be passed to the app.
In android studio I am struggling with the following in the MainActivity;
Intent intent = getIntent();
Uri data = intent.getData();
String url = data.toString();
webView.loadUrl(url);
Okay, it works now. It was mainly in my code (duh).
AndroidManifest.xml; "https" is important (besides everything else).
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="www.sendamap.com" />
</intent-filter>
MainActivity.java; "this." was added before "getIntent().getData().
Uri uri = this.getIntent().getData();
if (uri != null) {
url = uri.toString();
}
webView.loadUrl(url);
I've an MVC ASP page with the following code:
<script type="text/javascript" src="https://TEST_DOMAIN.com/test.js"> </script>
#*<script type="text/javascript" src="https://LIVE_DOMAIN.com/Live.js"> </script>*#
Essentially I comment or uncomment the script I want to use if the site is Live or if its on Test. I'd love to be able to do this dynamically some how. One solution, perhaps, is if it could read the current URL and figure out if its Live/Test.
Updated with Answer (thanks Whipdancer)
In Web.config I have added the url:
<add key="BundleJS" value="https://TEST_DOMAIN.com/test.js" />
<!--<add key="BundleJS" value="https://LIVE_DOMAIN.com/Live.js" />
I will look into web.config transformations next. But this is much better than what I had before.
The next step was during Session_Start in the Global.asax.cs file I set the url to an application variable:
Application["BundleJS"] = System.Configuration.ConfigurationManager.AppSettings["BundleJS"];
After this was set I was able to go to the controller of the view (Tip: in my case the view was a layout so I went to the parent controller). On or after the ActionResult method I added the Application variable to the viewbag
ViewBag.BundleJS = HttpContext.Application["BundleJS"];
Finally in the cshtml page (which was _layout for me) I set the script up
<script type="text/javascript" src="#ViewBag.BundleJS"> </script>
Since you are using ASP.NET MVC - you can use web config transformations to handle your different environments.
More info on web config transformations
I would then use a web config parameter to determine the appropriate environment, that is loaded via global.asax (or possible in my primary view controller).
You would then be able to automatically determine the appropriate URL based on the environment you compiled to.
in test web.config:
<appSettings>
<add key="JSSource" value="https://TEST_DOMAIN.com/test.js" />
</appSettings>
in release web.config:
<appSettings>
<add key="JSSource" value="https://LIVE_DOMAIN.com/Live.js" />
</appSettings>
in global.asax you could do something like:
public class MvcApplication : System.Web.HttpApplication
{
public static string jsUrl;
protected void Application_Start()
{
jsUrl = System.Configuration.ConfigurationManager.AppSettings["JSSource"];
}
}
In you page you could then use something like this:
<script type="text/javascript" src="#jsUrl"> </script>
** I don't think this code will run as is. It is to give you a general idea.
You can check this answer:
https://stackoverflow.com/a/5819693/2710681
Alternatively, you can test with jQuery's Ajax getScript method but the above is probably better:
if (test) {
$.getScript( "https://TEST_DOMAIN.com/test.js", function( data, textStatus, jqxhr ) {
console.log( data ); // Data returned
console.log( textStatus ); // Success
console.log( jqxhr.status ); // 200
console.log( "Test load was performed." );
});
} else {
$.getScript( "https://LIVE_DOMAIN.com/Live.js", function( data, textStatus, jqxhr ) {
console.log( data ); // Data returned
console.log( textStatus ); // Success
console.log( jqxhr.status ); // 200
console.log( "Live load was performed." );
});
}
Since you are using Razor you could do it server side:
#if(isLive)
{
<script type="text/javascript" src="https://TEST_DOMAIN.com/test.js"> </script>
}
else
{
<script type="text/javascript" src="https://LIVE_DOMAIN.com/Live.js"> </script>
}
where isLive is a variable that indicates if current environment is Test or Live. This solution will run server side and won't pollute the HTML with more scripts
EDIT: If you don't have an environment variable, you could pass a bool object from the controller to the view (using ViewBag), setting to true if it's build in DEBUG, using preprocessor directives.
[Code]
bool isLive = true;
#if DEBUG
isLive = false;
#end if;
your if statement could be
var a = document.createElement('a');
a.href = url;
var hostname = a.hostname;
if(hostname == "yourlivewebsite.com") {
} else {
}
I would like to send a number to a SOAP "server"(I don't know if I can call it a server, correct me if I'm wrong) and receive a response using HTML, I've seen many questions with answers containing examples of sending an XML request such as below, but I have no idea on how to receive and see a response on HTML, sorry I'm new to SOAP.
P.S.: Of course, by HTML I meant JavaScript within the HTML :P
Server: Here
Thanks in Advance!
<html>
<head>
<title>SOAP JavaScript Client Test</title>
<script type="text/javascript">
function soap() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'http://192.168.0.251:9080/wsa/wsa1', true);
// build SOAP request
var sr =
'<?xml version="1.0" encoding="utf-8"?>' +
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:services-progress-com:notavailable">' +
'<soapenv:Header/>' +
'<soapenv:Body>' +
'<urn:lnestagio>' +
'<urn:vvalor>5</urn:vvalor>' +
'</urn:lnestagio>' +
'</soapenv:Body>' +
'</soapenv:Envelope>';
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert('done use firebug to see response');
}
}
}
// Send the POST request
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send(sr);
// send request
// ...
}
</script>
</head>
<body>
<form name="Demo" action="" method="post">
<div>
<input type="button" value="Soap" onclick="soap();" />
</div>
</form>
</body>
<html>
SOAP's XML from my server
<wsdl:definitions xmlns:tns="urn:services-progress-com:ys:server" xmlns:S2="urn:services-progress-com:sys:server:Estagio" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:prodata="urn:schemas-progress-com:xml-prodata:0001" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:S1="urn:soap-fault:details" xmlns="http://schemas.xmlsoap.org/wsdl/" name="Estagio" targetNamespace="urn:services-progress-com:sys:server">
<wsdl:documentation>
Author=sys, EncodingType=DOC_LITERAL, WSA_Product=10.2B07 - N/A
</wsdl:documentation>
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" targetNamespace="urn:soap-fault:details">
<element name="FaultDetail">
<complexType>
<sequence>
<element name="errorMessage" type="xsd:string"/>
<element name="requestID" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:services-progress-com:sys:server:Estagio">
<element name="lnestagio">
<complexType>
<sequence>
<element name="vvalor" nillable="true" type="xsd:decimal"/> <!-- Here I think he gets the number I sent -->
</sequence>
</complexType>
</element>
<element name="lnestagioResponse">
<complexType>
<sequence>
<element name="result" nillable="true" type="xsd:string"/>
<element name="vcalc" nillable="true" type="xsd:decimal"/> <!-- And it returns the number multiplied by 2 -->
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="FaultDetailMessage">
<wsdl:part name="FaultDetail" element="S1:FaultDetail"/>
</wsdl:message>
<wsdl:message name="Estagio_lnestagio">
<wsdl:part name="parameters" element="S2:lnestagio"/>
</wsdl:message>
<wsdl:message name="Estagio_lnestagioResponse">
<wsdl:part name="parameters" element="S2:lnestagioResponse"/>
</wsdl:message>
<wsdl:portType name="EstagioObj">
<wsdl:operation name="lnestagio">
<wsdl:input message="tns:Estagio_lnestagio"/>
<wsdl:output message="tns:Estagio_lnestagioResponse"/>
<wsdl:fault name="EstagioFault" message="tns:FaultDetailMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="EstagioObj" type="tns:EstagioObj">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="lnestagio">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="EstagioFault">
<soap:fault name="EstagioFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="EstagioService">
<wsdl:port name="EstagioObj" binding="tns:EstagioObj">
<wsdl:documentation/>
<soap:address location="http://localhost:9080/wsa/wsa1"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Well, a SOAP server is designed to receive SOAP requests and send SOAP responses.
Since SOAP is basically XML, instead of expecting an HTML response from the server, it would be more appropriate to look for a mean to parse the XML of the SOAP response and display it in HTML.
But as I'm typing this answer, I think you may have misunderstood the goal of a SOAP server. It seems to me that you want to display the raw SOAP response directly to the client browser. But a SOAP server is not intended to work that way.
Typically a SOAP server is used by another server, by doing a SOAP request to it and then parsing the SOAP response. And this "other server" may be, for example, an HTTP server.
Let's take an example. I want to know the weather forecast of my city for tomorrow. I go to dummyweatherforecast.com and type the name of my city in the search field. But dummyweatherforecast.com does not store all the weather forecasts by itself. It may instead contact a SOAP server (specifically designed to provide weather forecasts) with a SOAP request containing the name of my city. The SOAP server returns a SOAP response with different weather information (sunny/cloudy, temperature, etc.) and then dummyweatherforecast.com processes this SOAP response (that is, as a reminder, XML) to display it to the client with a beautiful sentence like "It will be sunny tomorrow, with 86°F. Take your swimsuit !" ornamented with a beautiful sun iconography.
As you see, the client doesn't even know that a SOAP communication is held between dummyweatherforecast.com and the SOAP server. And this how SOAP is used : by servers themselves, and rarely directly by clients. This is what we call "web services", even though this term refers to a more general set of technologies used to make computers talk to each others.
I hope this brightened your mind a little bit.
PS : by the way, the link you give for your server points to an IP not available publicly (192.168 adresses are for private networks).
What I'm attempting seems relatively simple, but I can't seem to find a simple answer on how to do it. I have a WCF Web Service that is self hosted. It has one function that accepts zero parameters and returns a string. All I want to do is request that method from javascript and capture that string response in javascript
Here is the code I have, and so far it won't even return anything. I can get requests easily if I use something like SOAPUI.
App.Config
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="test.XKORE.MobileDeviceServices.Properties.Settings.ConnectionString"
connectionString="Data Source=tester;Initial Catalog=test;User ID=testc;Password=testp" />
</connectionStrings>
<system.web>
<compilation debug="true"/>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="test.XKORE.MobileDeviceServices.XKOREMobileService" behaviorConfiguration="XKOREMobileServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8523/test/XKORE/XKOREMobileService" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="test.XKORE.MobileDeviceServices.IXKOREMobileService" bindingNamespace="http://test.XKORE.MobileDeviceServices" />
<endpoint address="mex" binding="mexHttpBinding" contract="test.XKORE.MobileDeviceServices.IXKOREMobileService" bindingNamespace="http://test.XKORE.MobileDeviceServices" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="XKOREMobileServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Interface
[ServiceContract]
public interface IXKOREMobileService
{
[OperationContract]
string GetChartData();
// TODO: Add your service operations here
}
SOAP Request
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IXKOREMobileService/GetChartData</Action>
</s:Header>
<s:Body>
<GetChartData xmlns="http://tempuri.org/" />
</s:Body>
</s:Envelope>
Javascript (Not Working)
var response = BuildSOAPMessage('GetChartData');
alert(response);
function BuildSOAPMessage (func) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://localhost:8523/test/XKORE/XKOREMobileService", true);
var msg = '';
msg += '<?xml version="1.0" encoding="utf-8"?>'
msg += '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">'
msg += '<soapenv:Header/>'
msg += '<soapenv:Body>'
msg += '<tem:' + func + '/>'
msg += '</soapenv:Body>'
msg += '</soapenv:Envelope>'
alert (msg);
// Send the POST request
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.setRequestHeader("SOAPAction", "http://tempuri.org/IXKOREMobileService/GetJSONChartData");
xmlhttp.send(msg);
return xmlhttp.responseXML;
}
There are a couple of issues in your code:
You specified that the XmlHttpRequest object will be asynchronous (passing true in the third parameter to the open call). That means you don't get the results after calling send, you need to wait for the event to access the responseXML property.
It's very likely that you're hitting a cross-domain restriction. XMLHttpRequest cannot, by default, send requests to sites other than the one where the page arrived. You're self-hosting the WCF service, and I'm assuming that the page which hosts the JavaScript code is coming from some other domain. That will be blocked by the browser.
Closing this thread and opening a separate one since the issue is more related to cross domain problems.
I wrote a WCF service that returns a JSON response. I then created an html page with some JavaScript code to test the function. When I published the service to the staging environment (which uses SSL to emulate the production environtment), I had to update the web.config file of my service to work over HTTPS. All seems ok when I browse directly to the .svc endpoint (the service page displays in both http and https) and when I call the service in a browser (I am prompted to download the JSON response) however when I change my test page to point to the https version, I get an 'Access Denied' error.
Here is the code for the servicemodel section of my config file:
<system.serviceModel>
<services>
<service name="Services.PromotionCodeGeneration" behaviorConfiguration="md">
<endpoint address="" binding="webHttpBinding" contract="Services.IPromotionCodeGeneration" behaviorConfiguration="webHttp" bindingConfiguration="webBindingSecure"/>
<endpoint address="" binding="webHttpBinding" contract="Services.IPromotionCodeGeneration" behaviorConfiguration="webHttp" bindingConfiguration="webBinding"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="md">
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webBindingSecure">
<security mode="Transport"/>
</binding>
<binding name="webBinding">
<security mode="None"></security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
Here is the code from my test page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script>
function api_test() {
var url = "https://test.mydomain.com/Services/PromotionCodeGeneration.svc/contest/useremail#mydomain.com";
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.setRequestHeader("Authentication-Key", "LK589-JIJO-SHG9-0987-65TG-HJKU-Y$GH");
client.send();
var responseText = client.responseText;
var result = JSON.parse(responseText);
document.writeln("Id: " + result.Id + "<br/>");
document.writeln("Code: " + result.Code + "<br/>");
var expiryDate = "";
if (result.Expires != null){expiryDate = result.Expires;}
document.writeln("Expires: " + expiryDate + "<br/>");
document.writeln("Status: " + result.Status + "<br/>");
}
</script>
</head>
<body onload="api_test();">
</body>
</html>
I have been researching the problem for 2 days. I find alot of people saying you can't use the 'XMLHttpRequest' method across domains but it works find for me over basic http so I find that hard to believe. I have also tried MANY different servicemodel configuration suggestions however none worked for the https communication. Does anyone see anyything in my config or calling page that is causing the 'Access Denied' response over https?
Any help would be appreciated.
Do the HTML page and the service conform to the Same Origin Policy?
The domain name must be the same, including subdomains (so you couldn't, for example, load a file hosted on test1.example.com in a page on test2.example.com).
The protocol (e.g. http or https) must be the same.
The port must be the same (for example, you can't load a file at example.com:8080 from a page at example.com).
All AJAX requests need to meet this policy - otherwise, as #Mike Miller suggested, you may need to look at JSONP.