0 Replies Latest reply on Mar 17, 2007 4:56 PM by Ottawaien

    HTTPService problem : I can call only once my service running on Tomcat !!

    Ottawaien
      Hi,

      I am having a weird problem using HTTPService.
      I am hitting a service built using Spring (it is a Spring controller running in Tomcat).
      When I launch my flex application, and hit my button I see a trace on the server side. But the second time it does not work.
      I noticed later, that if I wait like 20 minutes, and hit the button again, the request get to my server and I can see the trace !
      Is there something I have to do on the client side to reset a configuration parameter that I might have missed ?

      I am putting my example that you can see what I am doing :

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="initVars()" layout="absolute">
      <mx:Script>
      <![CDATA[
      //import mx.rpc.http.HTTPService;
      import mx.controls.Alert;
      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;

      [Bindable]
      public var myLoader:URLLoader;
      public var counter:Number = 1;

      public var selectedNode:XML;
      public var message:String;
      public var treeModel:XML=
      <node label="Mail Box">
      <node label="Inbox">
      <node label="Marketing"/>
      <node label="Product Management"/>
      <node label="Personal"/>
      </node>
      <node label="Outbox">
      <node label="Professional"/>
      <node label="Personal"/>
      </node>
      <node label="Spam"/>
      <node label="Sent"/>
      </node>;

      private function initVars():void {

      }


      // Event handler for the Tree control change event.
      public function treeChanged(event:Event):void {
      selectedNode=Tree(event.target).selectedItem as XML;
      }

      public function onClick2():void
      {
      sendRequest2.send(counter++);

      }

      public function onClick():void
      {
      sendRequest.
      sendRequest.send(counter++);
      }

      public function httpResultHandler(event:ResultEvent):void
      {
      Alert.show("Message", counter.toString());

      }
      public function httpFaultHandler(event:FaultEvent):void
      {
      Alert.show(event.fault.message, "Fault Message .....");
      }


      ]]>
      </mx:Script>

      <mx:HTTPService
      id="sendRequest"
      url=" http://localhost:8080/eval/start.do"
      method="POST"
      result="httpResultHandler(event)"
      fault="httpFaultHandler(event)"
      useProxy="false" />

      <mx:HTTPService
      id="sendRequest2"
      url=" http://localhost:8080/eval/start2.do"
      method="POST"
      useProxy="false" />

      <mx:Panel title="Class Management" height="75%" width="775"
      paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
      <mx:MenuBar width="398" id="myMenuBar" labelField="@label">
      <mx:XMLList>
      <menuitem label="New Course" >
      </menuitem>
      <menuitem label="New Class"/>
      </mx:XMLList>

      </mx:MenuBar>

      <mx:HDividedBox width="100%" height="100%">
      <mx:Tree id="myTree" width="401" height="100%" labelField="@label"
      showRoot="false" dataProvider="{treeModel}" change="treeChanged(event)"/>
      <mx:ViewStack id="viewstack1" width="200" height="235">
      <mx:Canvas label="MainView" width="337" height="100%">
      <mx:Button x="98" y="30" label="Get Query String" click="onClick()"/>
      <mx:Label x="101.5" y="60" width="121" id="myLabel"/>
      <mx:Button x="115" y="175" label="Start 2" click="onClick2()"/>
      </mx:Canvas>
      <mx:Canvas label="NewClassView" width="100%" height="100%">
      </mx:Canvas>
      <mx:Canvas label="NewCourseView" width="100%" height="100%">
      </mx:Canvas>
      </mx:ViewStack>
      </mx:HDividedBox>

      </mx:Panel>

      </mx:Application>


      Thanks a lot for your help,

      Salim.