You can find now JsonBridge on Facebook by visiting http://www.facebook.com/jsonbridge Code samples, downloads notifications and other related news will be posted on http://jsonbridge.com and Facebook both now.
private var urlJsonBridge:String = ‘http://jsonbridge.mywdk.com/jsonbridge/’;
<?xml version=”1.0”?>
<configuration>
<appSettings>
<add key=”jsonbridge.AuthEnabled” value=”true”/>
</appSettings>
<system.web>
<compilation debug=”true” targetFramework=”4.0”/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests=”true”/>
</system.webServer>
</configuration>
JsonBridge.url = urlJsonBridge;
JsonBridge.useAuthorization = true;
JsonBridge.authorizationHeader = new URLRequestHeader(‘Authorization’, ‘Simple demo:demo’);
JsonBridge.execute(‘_browse’, null, null, function (success:Object):void
{
textOutput.text = ”;
if (success.type == “error”)
{
textOutput.text = success.message;
} else
{
for (var i:int = 0, l:int = success.result.length; i < l; i++)
{
textOutput.text += (success.result[i] + ‘\n’);
}
}
}, function (failure:Object):void
{
textOutput.text = failure.message;
});
Authorization: Simple demo:demo
jQuery client is ‘preloaded’ with JsonBridge, you can access it on your web application/site via simply typing http://yoursitename/jsonbridge/jquery.jsonbridge.js, you can see it as an example on http://jsonbridge.mywdk.com/jsonbridge/jquery.jsonbridge.js, you can also directly include it same way into your html like:
<script type=”text/javascript” src=”http://jsonbridge.mywdk.com/jsonbridge/jquery.jsonbridge.js” ></script>
We are glad to anounce that ActionScript 3 client for JsonBridge available as well and now it’s a part of sas3lib (available via SVN from http://labs.skitsanos.com:8888/svn/sas3lib). JsonBridge client available in com.skitsanos.net.remoting package of sas3lib.
It has jut one method: execute() which accepts following parameters:
Example on how to use it:
var params:Array = [{location: 23, dateTo: ‘01/01/2011’, dateFrom: ‘03/18/2011’}];
var jb:JsonBridge = new JsonBridge();
jb.url = ‘http://mywebsite/jsonbridge/’;
jb.execute(‘Reporting.ReceivedVolumeReport’, ‘getTotalsForPackagingItems’, params, function(e:Object):void
{
trace(e.toString());
}, function(e:Object):void{
trace(e.message);
});
Just wanted to share couple of notes on what’s cooking wond here at Skitsanos Labs… Recently i was banging my head into a wall on where to find some simple and effective way to call remote methods on server side and return back results to my application written in JavaScript and in Adobe Flex. There are quite many frameworks that allows you to do RPC or Remoting, but none of them actually was simple enugh to jump start any application with minimal effort, and we had in mind at least following list if requirements:
So, last 2 days i spend on making JsonBridge that goes to be part of next WDK10 (set of in house libraries we use in all projects, mainly made for modular content management engine). As result I have simple solution, that we can use in all projects we are working on. JsonBridge works with GET and POST methods, calls that require any method parameters, can be called with GET, calls that require some parameters sent should be done via POST.
Example of the method that can be called via GET:
public string execute()
{
return “WDK.API.JsonBridge.Text.execute() works!”;
}
I can call this method like this:
http://jsonbridge.vpn/jsonbridge/WDK.API.JsonBridge.Test/execute
Where:
Example of the method that requires POST:
public string executeWithComplexParam(string param, TestParamType param2)
{
return “Your param: ” + param + ” and param2.name: ” + param2.name + “, param2.status: ” + param2.status.ToString();
}
As you can see it has 2 parameters, one ‘simple’ and one ‘complex’ type, to invoke this method on server i just need to call URL like this:
http://jsonbridge.vpn/jsonbridge/WDK.API.JsonBridge.Test/executeWithComplexParam
and post in request body JSON array of parameters:
[
“my first parameter”,
{“name”: “zz”, “status”: “200”}
]
JsonBridge will analize number of parameters you sent, their types and so on and when everything meets invocation criteria it will call/invoke server side method and return you result.
Like this in my case:
Your param: my first parameter and param2.name: zz, param2.status: 200
Basically that’s it.
You can see it in action at this simple demo: http://jsonbridge.mywdk.com/