First Note : Add a handler to your webservice result event. in the
handler w
Point 1 : your webservice is returning ArrayList which flex will die
to understand :) , So the type cast it using ArrayCollection.
Point 2 : your arraylist (result) contains collection FlexProductData,
here again flex will die to understand. so Create a similar action
script class in Flex, and use it.
pacakage your.package.name{
public class FlexProductData {
public var productID : int ;
fproddata.setProductId(10);
fproddata.setName("kitkat");
fproddata.setPrice(10.25);
fproddata.setDescription("nice chocalate");
fproddata.setCategory("category");
}
On Sep 25, 12:04 pm, chan <[EMAIL PROTECTED]> wrote:
> Hi Imtiyaz.m.s ,Anubhav
>
> Thanks for your response,
>
> I am understanding what you are saying. But as I am new to this
> technology, I am not understanding of what type of class I should
> write so that it can be type casted with FlexProductData. Is it
> actionscript class that you were talking about?
>
> I will let you know what exactly my webservice returns,
>
> See after calling the getData method of the webservice mentioned
> above, it goes to getData method of the webservice. Please see the
> getData method below.
>
> public List getData() throws AuthorizationException,
> StartIndexOutOfBoundsException {
> ArrayList list = new ArrayList();
> FlexProductData fproddata= new FlexProductData();
> fproddata.setProductId(10);
> fproddata.setName("kitkat");
> fproddata.setPrice(10.25);
> fproddata.setDescription("nice chocalate");
> fproddata.setCategory("category");
> list.add(fproddata);
> return list;
> }
>
> This result I want to show on ui using above flex program i.e.
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> backgroundColor="#FFFFFF">
> <mx:WebService id="srv" wsdl="http://localhost:8080/
> tdemandweb/
> services/ProductThresholdService?wsdl" showBusyCursor="true" />
> <mx:DataGrid dataProvider="{srv.getData.lastResult}"
> width="100%"
> height="100%">
> <mx:columns>
> <mx:DataGridColumn dataField="name"
> headerText="Name"/>
> <mx:DataGridColumn dataField="price"
> headerText="Price"/>
> <mx:DataGridColumn dataField="productId"
> headerText="productId"/>
> <mx:DataGridColumn dataField="description"
> headerText="description"/>
> <mx:DataGridColumn dataField="description"
> headerText="description"/>
> </mx:columns>
> </mx:DataGrid>
> <mx:Button label="Get Product Data" click="srv.getData()"/>
> </mx:Application>
>
> Now, please let me know where to write the compitible FlexProductData
> class and if possible how?
>
> and how to use that class in my flex program?
>
> Please let you know if you need any other information from my side.
>
> Regards,
> chandan
>
> On Sep 24, 10:28 pm, imtiyaz <[EMAIL PROTECTED]> wrote:
>
> > Yes anubhav is on right track,
> > From the error its clear that you are returning FlexProductData
> > object, when it reaches to Flex it tries to type cast it with the type
> > you are using, here is the problem. so solution create a similar as
> > class and type cast it with that.
> > If you already doing that please check property types in both flex and
> > java, java should contain as compatible data types, else it will
> > throws the TypeCasting error.
>
> > Regards,
> > Imtiyaz.m.s
>
> > On Sep 24, 10:21 am, anubhav_RIA <[EMAIL PROTECTED]> wrote:
>
> > > Hi chandan,
>
> > > From the error it seems like your call to the wsdl is succeessfull but
> > > the problem seems to be somewhere in the type casting the values
> > > returned from the wsdl. it says it throws exceptin in the
> > > resultHandler function of the AbstractInvoker. try to locate where you
> > > are using FlexProductData type object.
>
> > > Only then this problem can be nail down.
>
> > > Regards,
> > > Anubhav
>
> > > On Sep 23, 9:10 pm,chan<[EMAIL PROTECTED]> wrote:
>
> > > > Hi All,
>
> > > > I am using jboss-4.2.2.GA as the application server. I have copied
> > > > flex data service i.e. flex folder contianing its jar
> > > > file ,configurationf files etc under web-inf folder of my
> > > > project.Similary flex related entries are added in web.xml.
>
> > > > I am trying to invoke webservice through following code
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> > > > backgroundColor="#FFFFFF">
> > > > <mx:WebService id="srv" wsdl="http://localhost:8080/tdemandweb/
> > > > services/ProductThresholdService?wsdl" showBusyCursor="true" />
> > > > <mx:DataGrid dataProvider="{srv.getData.lastResult}"
> > > > width="100%"
> > > > height="100%">
> > > > <mx:columns>
> > > > <mx:DataGridColumn dataField="name"
> > > > headerText="Name"/>
> > > > <mx:DataGridColumn dataField="price"
> > > > headerText="Price"/>
> > > > </mx:columns>
> > > > </mx:DataGrid>
> > > > <mx:Button label="Get Product Data" click="srv.getData()"/>
> > > > </mx:Application>
>
> > > > After clicking "Get Product Data" button , I am calling getData
> > > > method of the webservice. As i have put logger statemetn in the
> > > > getData method, I can see that getData method is properly called. But
> > > > after returning from the webservice, it is showing me the following
> > > > error on the UI,
>
> > > > [RPC Fault faultString="Cannot find type for: FlexProductData"
> > > > faultCode="DecodingError" faultDetail="null"]
> > > > at mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/
> > > > internal::processResult()
> > > > at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/
> > > > internal::resultHandler()
> > > > at mx.rpc::Responder/result()
> > > > at mx.rpc::AsyncRequest/acknowledge()
> > > > at DirectHTTPMessageResponder/completeHandler()
> > > > at flash.events::EventDispatcher/dispatchEventFunction()
> > > > at flash.events::EventDispatcher/dispatchEvent()
> > > > at flash.net::URLLoader/onComplete()
>
> > > > If same code i execute through flex builder 3 , it is properly invoke
> > > > the webservice and displays the data. However, if i call that
> > > > webservice through flex application which is deployed in jboss, it is
> > > > showing above error.
>
> > > > I really new to this technology. I do not understand whether there is
> > > > problem of the version which is used in jboss or what ?
>
> > > > Could anybody let me know what would be the problem? how to solve that
> > > > problem?
>
> > > > This is urgent requirement and hence early response will be really
> > > > appriciated.
>
> > > > Thanks,
> > > > Chandan- 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]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---