You need to sign in to do that
Don't have an account?
mbbender
Trouble with remoteFunction AJAX proxy
Does anyone have a good debug environment or resources for inspecting and/or walking through the cross-domain information transfer?
I'm using the following code and am having troubles determining if my php script is even being called and if so what I should be expecting in php.
Code:
function sendObj(objectToSend) { sforce.debug.log("Sending object: " + {"contactContainer":objectToSend}); try{ sforce.connection.remoteFunction( { url: "http://mydomain.com/middleware.php", requestHeaders: {"Content-Type": "application/x-www-form-urlencoded"}, requestData: {"contactContainer":objectToSend}, mimeType: "text/xml", method: "POST", onSuccess: function(response) { document.getElementById("result").value = response.textContent; }, onFailure: function(response) { document.getElementById("result").value = "Failed " + response; } } ); }catch(e){ alert("Error in sendObj: " + e); } } // end sendObj
i think request data is a string not a javascript object.
yourobject.toString();
which will generate JSON format of that object.
then your server will have to unwrap/unpack the JSON format
for debugging, you can just send "hello world" to make sure your PHP can see the data.
So I'm trying hello world, but its not invoking my php script. I have a feeling that this remoteFunction() is not working.
Code:
I've registered http://subdomain.mydomain.com as an acceptable URL in my salesforce configurations. Not sure why this isn't calling my mbbtest.php file. Not sure how to debug it either. I also can't find to much info about the remoteFunction() other than an article using it.
400 Endpoint protocol(http/https) mismatch: http://subdomain.mydomain.com/mbbtest.php
any ideas why?
I have it configured for http everywhere I can find.
I have another question.
How do I access the requestHeader from within php?
i'm sure you can get a response on the PHP developer board.
http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=3036
And I posted an enhance request to ideaexchange. If you agree with me please vote from here.
http://ideas.salesforce.com/article/show/70257/Allow_http_web_services_callout_in_AJAX_Proxy
I'll try the php dev boards. Thanks for all the help.