a SWX RPC implementation in C# for the Microsoft .NET platform.
check out http://swxformat.org/ for more information on SWX RPC and SWX PHP
check http://swxruby.org/ for more info on the Ruby port of SWX RPC
It’s been nearly a week since I posted so I thought I’d just let you know that nothing has happened recently…
I was away all weekend with family so I haven’t made any progress with SWX.NET. I’m planning on committing a good long evening or two to it this week so hopefully I’ll have a better post for you later in the week.
I have just finished what I might call version 0.0.1 of the .NET SWX Assembler.
This implements output of all the ActionScript types through a limited subset of the data types supported by the .NET framework. Listed in the table at the bottom of this post are the supported types and their associated ActionScript types.
So with all that said it does mean that I can now point the TestDataTypes.swf at my SWX.NET gateway and all the types return correctly!!!

Milestone No.1 me thinks :)
Now that I have this limited (but importantly working) Assembler I can start working on the input (JSON parsing) for putting requests through the gateway. The reason I am choosing to proceed in this manner is two fold:
1) I think it is more important at this stage to get a working SWX.NET gateway even if service classes have to return one of a specific list of types rather than spend forever implementing type conversions for all the .NET types.
2) I’m not sure as to the best way to procede with writing conversions for *all* the types.
SWX.NET Data Type Conversion
| .NET Type | | ActionScript Type |
| | | |
| System.Boolean | | Boolean |
| System.String | | String |
| System.Int32 | | Number |
| System.Int16 | | Number |
| System.Int | | Number |
| System.Double | | Number |
| System.Single | | Number |
| System.Collections.Hashtable | | Object |
| System.Collections.ArrayList | | Array |
| SWX.DataTypes.NullValue | | null |
What is SWX.DataTypes.NullValue?
This is a little class I put together to represent the ActionScript NULL value as my assembler doesn’t like trying to parse the C# null into SWF bytecode so NullValue.ToString() returns “02” (null in SWF bytecode).
I’m having some problems with the application in that my SWX.NET gateway will run fine for a few requests but then starts running really slowly, and i don’t mean it starts hammering my CPU. It just runs s-l-o-w-l-y!
I’m not sure what the problem is, I’ve got a feeling it’s to do with my use of Reflection in an ASP project but under the *idea* of the .NET framework this shouldn’t be an issue.
Right now its 5:30pm on Friday so I’m gonna call it a day but I’ve got some plans for testing without the reflection and also deploying it to a Win 2k3 server here in the office some time next week and see if it’s an issue in IIS 5.1 and if IIS 6 doesn’t sort… but again, under the theory of the .NET framework this shouldn’t be the case.
Update 24/09/2007
Please make sure when using a content length header, you pass the correct value for the length of the content :P
I started porting SWX to the .NET platform about two weeks ago and i’ve made some good progress.
Due to work and home commitments i’ve only managed to spend a few days on it.
So far I’ve got the run-time class instantiation running via the wonderful reflection capabilities of .NET and i’ve also got my SWX gateway returning valid data for Integer, Bool and string types.
Work continues to allow translation between ActionScript Arrays and Object to C# ArrayLists and Hashtables respectively and then onto Custom types and other craziness.
Once all the ActionScript types are supported, both incoming and outgoing. I’ll tidy and comment the code and get the source into some version control repository (google code??) and make it available for download.
I’ll keep you up to date,
Greg