Hi Mahee,
                 Here i am sending you a sample code . Hope it should help
you.

  <?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;

           [Bindable]
           private var shippingInfo:XMLList;

        public function handleXML(event:ResultEvent):void
            {
                shippingInfo = event.result.option as XMLList;
            }

        public function handleFault(event:FaultEvent):void
        {
           Alert.show(event.fault.faultString, "Error");
        }
]]>
</mx:Script>

    <mx:HTTPService id="xmlRPC" resultFormat="e4x" url="
http://www.flexmonkeys.com/F3GSE/PartII/quickstart/xmlHttpService.aspx";
result="handleXML(event);" fault="handleFault(event);" useProxy="false">
    <mx:request xmlns="">
        <zipcode>{zipcode.text}</zipcode>
        <pounds>{weight_lb.text}</pounds>
    </mx:request>
</mx:HTTPService>

<mx:Label x="56" y="32" text="Zip Code" width="55" height="18"
textAlign="right" fontWeight="bold"/>
<mx:Label x="56" y="58" text="Weight" width="55" height="18"
textAlign="right" fontWeight="bold"/>
<mx:TextInput x="130" y="32" id="zipcode" width="160" height="22"/>
<mx:TextInput x="130" y="58" id="weight_lb" width="160" height="22"/>
<mx:Button x="130" y="95" label="Get Shipping Options"
click="xmlRPC.send();" width="160" height="22"/>
<mx:DataGrid dataProvider="{shippingInfo}" x="80" y="141" width="262"
height="92" id="shippingOptionsList" editable="false" enabled="true">
    <mx:columns>
        <mx:DataGridColumn headerText="Service" dataField="service" />
        <mx:DataGridColumn headerText="Price" dataField="price" />
    </mx:columns>
</mx:DataGrid>
</mx:Application>

If you want to see the return XML then add the following code to handleXML()
method

Alert.show(event.result.toString());

Regards,
Raghunathan Mohan


On Thu, Jan 28, 2010 at 10:30 AM, mahee <[email protected]> wrote:

> Hi Friends,
>
> Please help me to understand how I can populate a datagrid calling a
> webservice.
> Please provide me some easy to understand example or code.
>
> My target is to call an xml file using a webservice call in flex.
>
> Regards,
> Mahee
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to