| Fiach's profileNetwork Programming in ....BlogLists | Help |
|
September 27 Handwriting recognitionSeptember 21 Using Webservices with Flex I was working on a larger Flex example this morning: Sending SMS via a webservice in Flex But due to the Flash sandbox, there is a hurdle you have to jump, security wise, to access a webservice from Flash, and it first shows it's ugly head with this exception: [RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://www.freebiesms.co.uk/sendSMS.asmx?wsdl)"] at mx.rpc.wsdl::WSDLLoader/faultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\wsdl\WSDLLoader.as:98] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:170] at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:225] at mx.rpc::Responder/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53] at mx.rpc::AsyncRequest/fault()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103] at DirectHTTPMessageResponder/securityErrorHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:389] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/redirectEvent() Which, after hunting on the Net, showed me that I needed a crossdomain.xml file thus: <cross-domain-policy> <allow-access-from domain="*"/> <allow-http-request-headers-from domain="*" headers="SOAPAction"/> </cross-domain-policy> - Oh, and I also found out that Webservice method names are case-sensitive, when I got this error: [RPC Fault faultString="Couldn't find method 'sendSms' in service." faultCode="Client.NoSuchMethod" faultDetail="null"] at mx.rpc.soap::Operation/createFaultEvent()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\soap\Operation.as:978] at mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\soap\Operation.as:763] at mx.rpc.soap::Operation/send()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\soap\Operation.as:693] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.rpc.soap.mxml::Operation/send()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\soap\mxml\Operation.as:170] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractService.as:290] at FreebieSMS/click()[C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\FreebieSMSFlex\FreebieSMSFlex\src\FreebieSMS.as:31] at FreebieSMSFlex/___FreebieSMSFlex_Button1_click()[C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\FreebieSMSFlex\FreebieSMSFlex\src\FreebieSMSFlex.mxml:4] September 20 Using Code-behind with FlexThis is a few steps on how to use Code-behind with Flex & Visual Studio 2008. Installed Ensemble Tofino (With SDK) This was my MXML file: <?xml version="1.0" encoding="utf-8" ?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Button x="45" y="33" label="Say Hello!" click="HelloWorld.click(event)"/> </mx:Application> And the .AS file was: package { import flash.events.Event; import flash.events.MouseEvent; import mx.controls.Alert; public class HelloWorld { public static function click(event:MouseEvent) { Alert.show("This responded to an event from code-behind"); } } } Ideally, The Application Class should inherit from HelloWorld, so that the click event could be protected rather than static; so it should be modified as follows: <?xml version="1.0" encoding="utf-8" ?> <my:HelloWorld xmlns:my="*" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Button x="45" y="33" label="Say Hello!" click="click(event)"/> </my:HelloWorld> and the AS file thus: package { import flash.events.Event; import flash.events.MouseEvent; import mx.controls.Alert; import mx.core.Application; public class HelloWorld extends Application { protected function click(event:MouseEvent) { Alert.show("This responded to an event from code-behind"); } } } Facebook App developmentFreebie SMS Facebook AppDownload link: Download Facebook App with source code in C#Facebook link: Free SMS Facebook App This is a Facebook App for sending free SMS messages to UK mobile phones, It was created with the asp.net starter kit for C# 3.5. and can be downloaded from the links above with full source code. The only real departure from a standard asp.net page, is that it gets the 'from name' from the Facebook profile, like this: protected string GetUserName() { try { facebook.Schema.user userinfo = Master.API.users.getInfo(Master.API.uid); return userinfo.first_name; } catch { return "Someone"; } } Note, that the exception can be thrown on first load, before the user has accepted access to their own profile, hense the try/catch September 06 Setting up SQL server Azure This is my experience with setting up SQL server Azure (2008), pretty difficult, and very buggy, to be honest, my feeling is to stay away from the CTP, but here's my 'walkthrough' I got this email a few days ago: Welcome to the SQL Azure CTP! We are excited to have you join us. Below are some steps to get you started, as well as links to helpful resources.
Getting Started 1) Visit https://sql.azure.com 2) Sign in with a valid Windows LiveID 3) Enter your invitation code Your invitation code is: d329171f-c1fd-4060-862e-1a7f613ea8ce 4) Create your SQL Azure Server (and databases) So I stepped through the process, and set up an Azure database, then I found that I needed SQL server 2008 to connect to it, I downloaded SQLManagementStudio_x86_ENU.exe from It then crashed with this error: TITLE: SQL Server Setup failure. And I got in... after an hour. Now to figure out how to copy the databases! |
|
|