I have been having some issues when running multiple WebOrb instances (usually because of a different authentication scheme) where if I start using one destination and then switch to another, my SWF gets confused, and dose no know which remote instance to get execute the remote object at.
To combat the issue, i started hard coding my channel information for each instance, and I honestly like it more. I no longer need to clean my projects every time I make a change, and I always know where my .swf is pointing.
Like it or leave it, here is how its done.
import mx.rpc.remoting.RemoteObject;
import mx.messaging.Channel;
import mx.messaging.ChannelSet;
import mx.messaging.channels.AMFChannel;
private function init() : void {
remoteObject = new RemoteObject("GenericDestination");
var cs:ChannelSet = new ChannelSet();
var customChannel:Channel = new AMFChannel("my-channel", "http://myurl:80/WebOrbK/weborb.aspx");
cs.addChannel(customChannel);
remoteObject.channelSet = cs;
remoteObject.destination = "my-destination";
remoteObject.source = "MyNameSpace.MyClass";
//Probably would add remote object listeners here.
}
Greg Actionscript, FLEX, WEBORB
WebOrb has built in functionality which allows you to install it as a Windows Service. c:\inetpub\wwwroot\weborb30\weborbee.exe -install.
However I was unable to pass the port parameters when installing as a service, and I need to change the port. (i.e c:\inetpub\wwwroot\weborb30\weborbee.exe -install -port 2039)
Once installed I simply ran the following command
nssm install WebOrbService c:\Inetpub\wwwroot\weborbK\weborbee.exe “-port 2039″
Greg WEBORB
WebOrb has an excellent feature built in which allows you to generate Actionscript/Flex code from you deployed Java or .Net objects. The example on their website shows you how to use this code in MXML but not in actionscript. However, it is quite simple. Here is an example function I have used below.
//Dashboard Settings
[Bindable]
private var swooshmodel:swooshModel = new swooshModel();
private var swooshProxy:swoosh;
private function LoadUserSettings () : void
{
// Create a Responder for the call
var responder:mx.rpc.Responder = new mx.rpc.Responder(OnUserSettings,onFault);
this.swooshProxy = new swoosh( swooshmodel );
swooshProxy.getUserSettings(responder);
}
private function OnUserSettings (e:ResultEvent) : void
{ }
Greg FLEX, WEBORB
1) First make sure that the security level in IIS (at least for the WebOrb virtual Directory is set to Windows Integrated security)
2) CREATE A C# CLASS with the following function
public string getUsername()
{
System.Security.Principal
.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
string strName = p.Identity.Name;
return strName;
}
Flex Client Code Action Script
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
//import mx.rpc.remoting.RemoteObject;
import flash.net.registerClassAlias;
import mx.controls.Alert;
import mx.messaging.config.ServerConfig;
private var nc:NetConnection;
private var so:SharedObject;
private function establishConnection():void
{
var ro:RemoteObject = new RemoteObject();
ro.destination = "PANO2";
ro.addEventListener(ResultEvent.RESULT, dataHandler);
ro.getUsername();
}
private function dataHandler( event:ResultEvent ):void
{
var uname:String = new String();
uname = event.result.toString();
//At this point you have uname as a string. Do what you want with it.
}
]]>
Greg FLEX, WEBORB