Project Description
This is a very simple aspx page cobbled together for use on a SharePoint farm. It can be deployed to _layouts or run from any .NET web server. It will passthrough urlencoded POST's, SOAP POST's, and GET requests and return the results. Utlized for cross domain AJAX.

This could be used on any ASP.NET project. POST or GET with a parameter of u=<some urlencoded url with parameters> and it will send the data it receives back to you. POST SOAP to it and it will return a SOAP response back. Its pretty simple. I would be happy to hear any improvements you may have.

Example
If you had a service on another domain you wanted to call that was not
your sharepoint server and it looked like this:

http://intranet/?data=dosomework&moredata=domorework

You could call that in JS (jQuery) without jsonp by doing:

$.get('xdomainproxy.aspx?u=http%3A%2F%2Fintranet%2F%3Fdata%3Ddosomework%26moredata%3Ddomorework', function(data) {
$('.result').html(data);
alert('Load was performed.');
});

If you want to use SOAP over POST then:

function getContent(sentSoapEnv) {
$.ajax({
url: xdomainproxy,
type: "POST",
dataType: "xml",
data: data: {u:'urlencode(lists.asmx)', postData: 'urlencode(sentSoapEnv)',soapAction:'urlencode(soapactionurl)' },
complete: processContentResult,
contentType: "text/xml; charset=\"utf-8\""
});
}

Example of a soap action to set the correct header:

soapAction: "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"

Last edited Aug 28, 2012 at 7:00 PM by jkuter, version 8