4 Replies Latest reply on Jun 2, 2010 5:45 AM by Jasper234

    Connecting to a Webservice

    Jasper234

      Hey Guys,

       

      i am a newcomer in creating Flex applications and im trying to connect my application to a PHP-Webservice that i wrote myself. I am hosting this Service over localhost.

       

      I know for sure that the webservice works, because I tested it with PHP, but when I try to connect with Flex I am getting null as result and I dont waht is exactly missing in my code

       

      I hope you can help me

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                        xmlns:s="library://ns.adobe.com/flex/spark" 
                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
           <fx:Script>
                <![CDATA[
                     import mx.controls.Alert;
                     import mx.rpc.events.FaultEvent;
                     import mx.rpc.events.ResultEvent;
                     
                     private function faultHandler(event:FaultEvent):void
                     {
                          Alert.show(event.fault.message);
                     }
                     
                     private function resultHandler(event:ResultEvent):void
                     {
                          lbl_text.text=event.token.result.toString()
                     }
                ]]>
           </fx:Script>
           <fx:Declarations>
                <s:WebService id="MyWebService" wsdl="http://localhost/webservice/wsdl.wsdl">
                     <s:operation name="HalloWelt" fault="faultHandler(event)" result="resultHandler(event)">
                     </s:operation>
                </s:WebService>
           </fx:Declarations>
           <s:Button id="btn_lookup" label="Lookup" click="MyWebService.HalloWelt()" />
           <s:Label id="lbl_text" />
      </s:Application>