Cook Computing

« November 2008 »

Probem With Cross-Domain Silverlight Calls

I've just been trying to get a Silverlight control to make a cross-domain HTTP POST call using an experimental Silverlight build of XML-RPC.NET. I placed a client access policy file on the root of the server but I was still getting a System.Security.SecurityException when I tried to make the call. I eventually worked out the cause of the problem was that when I created the Silverlight project in Visual Studio I selected "Automatically generate a test page to host Silverlight at build time". This results in the page being loaded using the file:// scheme when debugging, and cross-scheme access is not allowed in this case, i.e. file:// to http://, even with a client access policy file on the server.

I created another project and this time chose the option to add a web project to the solution. The cross-domain calls, now http:// to http://, succeeded.

Posted by Charles Cook at 06:49 PM. Permalink. View Comments.

XML-RPC From F#

I recently downloaded the F# September CTP from the F# Developer Center and experimented with some code to make an XML-RPC call using XML-RPC.NET.
#light

open CookComputing.XmlRpc

type Request = { state1 : int; state2 : int; state3 : int; }

[<XmlRpcUrl("http://www.cookcomputing.com/xmlrpcsamples/RPC2.ashx")>]
type IStateName = 
    [<XmlRpcMethod("examples.getStateName")>]
    abstract GetStateName : number: int -> string
    [<XmlRpcMethod("examples.getStateStruct")>]
    abstract GetStateNames : request: Request -> string

let proxy = XmlRpcProxyGen.Create<IStateName>()
let name = proxy.GetStateName(1)
printfn "name is %s" name
let request = { state1 = 1; state2 = 2; state3 = 3; }
let names = proxy.GetStateNames(request)
printfn "names are %s" names
Posted by Charles Cook at 03:23 PM. Permalink. View Comments.