local open Web.XMLrpc fun call name t1 t2 a = rpc t1 t2 {url="http://www.smlserver.org/demo/xmlrpc_test_server.sml", method=name} a in val add = call "add" (pair(int,int)) int val neg = call "neg" int int end val res1 = Int.toString (neg(add(11,neg 5))) handle Web.XMLrpc.TypeConversion => "TypeConversion Error" val res2 = Int.toString (add(12,200)) handle Web.XMLrpc.TypeConversion => "TypeConversion Error" val res3 = Int.toString (neg 12) handle Web.XMLrpc.TypeConversion => "TypeConversion Error" val () = Page.return "XML-RPC Example" `Each of the calculations below are made using XML-RPC client calls to an XML-RPC server, which implements the neg and add operations. To see how easy it is to make your ML functions available as XML-RPC methods, see the source code for the server and the client available from the index page.
Expression | Result |
---|---|
neg(add(11,neg 5)) | ^res1 |
add(12,200) | ^res2 |
neg 12 | ^res3 |