2 Replies Latest reply on May 18, 2007 4:52 PM by skeeeter144

    Web Services?

    skeeeter144
      Can someone PLEASE give me an example of how to use an XMLRPC web service in FLEX2?
        • 1. Re: Web Services?
          Rahul Mainkar Level 1
          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" verticalGap="10">
          <mx:Script>
          <![CDATA[
          import mx.controls.Alert;
          ]]>
          </mx:Script>
          <mx:WebService id="employeeWS"
          destination="employeeWS"
          showBusyCursor="true"
          fault="Alert.show(event.fault.faultstring, 'Error');">
          <mx:operation name="getList" resultFormat="e4x">
          <mx:request>
          <deptId>{dept.selectedItem.data}</deptId>
          </mx:request>
          </mx:operation>
          </mx:WebService>
          <mx:HBox>
          <mx:Label text="Select a department:"/>
          <mx:ComboBox id="dept" width="150">
          <mx:dataProvider>
          <mx:ArrayCollection>
          <mx:source>
          <mx:Object label="Engineering" data="ENG"/>
          <mx:Object label="Product Management" data="PM"/>
          <mx:Object label="Marketing" data="MKT"/>
          </mx:source>
          </mx:ArrayCollection>
          </mx:dataProvider>
          </mx:ComboBox>
          <mx:Button label="Get Employee List"
          click="employeeWS.getList.send()"/>
          </mx:HBox>
          <mx:XMLListCollection id="xc"
          source="{employeeWS.getList.lastResult}"/>
          <mx:DataGrid dataProvider="{xc}" width="100%">
          <mx:columns>
          <mx:DataGridColumn dataField="name" headerText="Name"/>
          <mx:DataGridColumn dataField="phone" headerText="Phone"/>
          <mx:DataGridColumn dataField="email" headerText="Email"/>
          </mx:columns>
          </mx:DataGrid>
          </mx:Application>


          This ex. is from flex2 devguide page 1155
          Hope this helps you.
          • 2. Re: Web Services?
            skeeeter144 Level 1
            Thanks for the snippet! I might be missing something, but I don't think that's what I'm trying to do??

            Here's an example of how to do what I want in python:
            ------------------------------------------------------------------------------------------ --------------------
            #!/usr/bin/python

            from xmlrpclib import *
            FOO_Login = 'login'
            FOO_Password = 'pass'

            Server_URL = " http://xmlrpc.foobar.com/xmlrpc/Food"
            Auth_URL = " http://xmlrpc.foobar.com/xmlrpc/Authenticate"

            auth_server = ServerProxy(Auth_URL)
            token = auth_server.systemLogin(FOO_Login, FOO_Password)
            server = ServerProxy(Server_URL + "/::session_id::" + token)

            food = server.getFoodList()
            print "Food: %s" % food

            auth_server.logout(token)
            ------------------------------------------------------------------------------------------ --------------------



            Does anyone have any idea? :D