3 Replies Latest reply on Sep 29, 2008 11:24 PM by chandanmahajan

    Getting exception/error after calling webservice

      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:DataGridColumn dataField="name" headerText="Name"/>
      <mx:DataGridColumn dataField="price" headerText="Price"/>
      <mx:Button label="Get Product Data" click="srv.getData()"/>

      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.

        • 1. Re: Getting exception/error after calling webservice
          riesvantwisk Level 1
          are you returning a object?

          If so, did you also create the same object in as??

          • 2. Re: Getting exception/error after calling webservice
            chandanmahajan Level 1
            Hi riesvantwisk ,
            Thanks for your response,
            Please see my mxml file below,

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" initialize="Handler()">
            import mx.controls.Alert;
            import mx.rpc.soap.WebService;
            import mx.binding.utils.BindingUtils;
            import mx.collections.ArrayCollection;
            private var _stateService:WebService;
            private function Handler():void{
            _stateService = new WebService();
            _stateService.wsdl=" http://localhost:8080/tdemandweb/services/ProductThresholdService?wsdl"

            <mx:DataGrid id="Urdg" dataProvider="{_stateService.getData.lastResult.results}" width="100%" height="100%">
            <mx:DataGridColumn dataField="name" headerText="Name"/>
            <mx:DataGridColumn dataField="price" headerText="Price"/>
            <mx:DataGridColumn dataField="productId" headerText="Product Id"/>
            <mx:DataGridColumn dataField="description" headerText="Description"/>
            <mx:DataGridColumn dataField="category" headerText="Category"/>


            After calling getData method, webservice is returning me an object of the Resultlist class(user defined class) which contain a field results of type Arraylist. This arraylist object contains the object of FlexProductData.java

            Please see Flexproductdata.java below
            package com.tdemand.common.service.common.types;

            import java.io.Serializable;

            public class FlexProductData implements Serializable {
            private int productId;

            private String name;

            private String description;

            private String category;

            private double price;

            // and setter and getter method of above field

            In this way, webservice returning me the an object (named results) of ResultList Class which contains the Arraylist object results. This arraylist object i.e. results contains Flexproductdata objects.

            Now could you please let me know in what way the similar class i should create on the flex side? and where to put in project.
            I have deployed my project on jboss.

            Please let me know resposne ASAP possible as this is extermely urgent requirement in our project?

            One this, if i run above mxml through flex builder which uses sdk3.1.0 for compilation , it works fine. But if the similar file I deploy on jboss it is throwing me the above exception. I have included LCDS in my jboss. All other flex program are running fine in the jboss. Only this issue is causing me the problem.

            Let me know if you need more information on this.



            • 3. Re: Getting exception/error after calling webservice
              chandanmahajan Level 1
              Just for your reference Please see getData method of my webservice,

              public ResultList getData() throws AuthorizationException, StartIndexOutOfBoundsException {
              logger.debug("***************started getData method of productthresholdspojoserviceimpl");
              ResultList result = new ResultList();
              List list = new ArrayList();
              for(int i=0;i<21;i++)
              FlexProductData fproddata= new FlexProductData();
              fproddata.setDescription("nice chocalate:"+i);

              return result;