Hi Mahee,

I dont know wht could be the problem ...

better try with

Alternatively, you can use the following ColdFusion, PHP, or Java URLs:

http://www.coldfusionportal.org/flex3cf/PlainHTTPService.cfm
http://examples.adobe.com/flex3/exchangingdata/text/plainHttpService.php
http://examples.adobe.com/flex3app/flex3samples/exchangingdata/text/PlainHttpService.jsp

Coding explanation for the following part

<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>

This above code says you are trying to use a *HttpService *which will use
the given url. The result format will be in *e4x* (*E4X* means "ECMAScript
For XML") . If the result is success then the method *handleXML(event)* will
be triggered. If the redult is failed then *handleFault(event)* will be
called , where you can handle the error and give a custom message to the
user. the *useProxy *specifies whether to use the Flex proxy service. The
default value is false.
inside the *<mx:request>* node we will give the parameter values to that
services . for this particular service we are giving *zipcode *and *pounds *as
parameter


        Here you can find how this code works.

      Tutorial for that Code :
http://learn.adobe.com/wiki/display/Flex/2d.+Tutorial
       Coding Explanation :
http://learn.adobe.com/wiki/display/Flex/2b.+Code+Files


Regards,
Raghunathan Mohan


On Fri, Jan 29, 2010 at 12:04 AM, mahee <[email protected]> wrote:

>
> Hi Raghunath,
>
> Thanks for your reply. I have few questions from the code -
> I copied the code and executed. I entered the zip code and weight and
> clicked the button. I get a http error.
>
> Can you tell what is wrong?
>
> Also I have quest abt the code - what does the below code does, please
> explain
>
>    <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>
>
> Regards,
> Mahee
>
>
>
> On Jan 28, 6:31 am, Raghunathan Mohan <[email protected]>
> wrote:
> > 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]>
> <flex_india%2bunsubscr...@googlegrou­ps.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/flex_india?hl=en.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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