4 Replies Latest reply on Aug 13, 2007 6:13 AM by kcell

    yet another HTTPService question

    AndreasWagner
      hello there,

      i am trying to access a public rss feed (actually from our automobile club in austria). everything works fine when i run my flex app locally but it will not run from my server.

      there is (apparently) a security issue acessing an xml feed that is in a different domain. i understand all this but i need a fix. i have no access to the remote server and therefore can not use a crossdomain file.

      i have used a php file on my server which i url to and in which i readfile(the remote rss feed) and this works fine (hooray). my flex data grid is displaying the feed but then goes completely cold and stops responding to anything..

      i post my code and hope that somebody sees something that i am overlooking...to see the problem online go to http://www.wagnerswebpulp.com/externalinterface.html (it is work in progress) there are 5 icons on my inital app which call other flex apps. the one i have a problem with is the second from the left..

      I appreciate your help

      thank you

      andy


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" width="320" height="400" creationComplete="updateClicked()" xmlns:local="*" backgroundAlpha="0" layout="absolute">
      <mx:HTTPService id="rssFeed" result="log(event)" fault="defaultFault(event)" url=" http://www.wagnerswebpulp.com/proxy.php" />
      <mx:Script>

      <![CDATA[
      import flash.external.*;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;
      import mx.controls.Alert;
      private function updateClicked():void{
      spinner.play();
      rssFeed.send();
      }
      public function log(event:ResultEvent):void {
      spinner.stop();
      }
      public function showErrorDialog(event:FaultEvent):void {
      // Handle operation fault.
      Alert.show(event.fault.faultString, "Error");
      }
      public function defaultFault(event:FaultEvent):void {
      // Handle service fault.
      Alert.show(event.fault.faultString, "Error");
      }
      public function closeClicked():void {
      var f:String = "closeTraffic";
      var m:String = ExternalInterface.call(f,"dummy");
      trace(m);
      }

      ]]>
      </mx:Script>
      <mx:Panel width="320" height="400" cornerRadius="15" id="myPanel" title="Aktuelle ÖAMTC Meldungen" fontFamily="Verdana" fontSize="12" backgroundAlpha="0.8" alpha=".8" dropShadowEnabled="true" borderColor="#8080ff" backgroundColor="#8080ff" roundedBottomCorners="true" borderAlpha="0.8" layout="absolute" borderThickness="0" borderThicknessBottom="0" borderThicknessLeft="0" borderThicknessRight="0" borderThicknessTop="0" titleIcon="@Embed('trafficNews21x21.png')" toolTip="Hier sehen Sie die 5 aktuellen Verkehrs-Meldungen vom ÖAMTC...">
      <mx:DataGrid id="entries" width="300" height="232" dataProvider="{rssFeed.lastResult.rss.channel.item}" click="body.htmlText=rssFeed.lastResult.rss.channel.item[entries.selectedIndex].descripti on" toolTip="Klicken Sie hier, um detailierte Informationen für diese Meldung anzuzeigen..." variableRowHeight="true" wordWrap="true" backgroundAlpha="0.8" fontSize="10" x="9" y="4">
      <mx:columns>
      <mx:Array>
      <mx:DataGridColumn dataField="title" width="180" headerText="Meldung" />
      <mx:DataGridColumn dataField="pubDate" width="120" headerText="Eingegangen am" />
      </mx:Array>
      </mx:columns>
      </mx:DataGrid>
      <mx:TextArea id="body" editable="false" width="300" height="116" x="10" y="244" backgroundAlpha="0.8" paddingLeft="5" paddingRight="5" fontFamily="Verdana" fontSize="10" color="#000000"/>


      </mx:Panel>
      <local:Spinner id="spinner" x="246" y="5" />
      <mx:Button click="updateClicked()" x="268" y="5" icon="@Embed('update16x16.png')" width="21" height="21" useHandCursor="true" buttonMode="true" mouseChildren="false" toolTip="Verkehrs-Meldungen Aktualisieren..."/>
      <mx:Button click="closeClicked()" x="290" y="5" icon="@Embed('close16x16.png')" width="21" height="21" useHandCursor="true" buttonMode="true" mouseChildren="false" toolTip="Verkehrs-Meldungen Schließen..."/>
      </mx:Application>


      .
        • 1. Re: yet another HTTPService question
          AndreasWagner Level 1
          sorry guys,

          the moment i clicked post message the answer came to me in a flash (smile) but i am to emberrased to tell you what my problem was....

          have a great day

          andy
          • 2. yet another HTTPService question
            kcell Level 2
            read your entry before lunch and started to compile your code and saw the problem at your page ... went out to lunch and the problem was solved

            I just imagine that the problem was not in the code you posted ...

            beside this ... nice app

            best regards,
            kcell
            • 3. Re: yet another HTTPService question
              sandeepmkumar Level 1
              Hi ,

              TILL NOW ANY BODY HAS RUN APPLICATION ( calling flex application in url) WHICH INVOKES A SERVLET PERFORMS REQUEST/RESPONCE . IF YES PLEASE SOLVE MY CODE.

              ELSE
              PLEASE HELP ME WITH A SAMPLE CODE/Example.

              currently i have a login.jsp in which i am calling source="./login.mxml"
              code for login.jsp
              /**********************************/
              <%@ taglib uri="FlexTagLib" prefix="mm" %>
              <html>
              <head>
              <title>This is calling HelloServlet</title>
              </head>
              <body>
              <form action=./HelloServlet method=POST>
              <mm:mxml source="./Login.mxml">

              </mm:mxml>
              </form>
              </body>
              </html>
              /*********************************/

              and code in login.mxml
              /*****************************************************/
              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" >
              <mx:Panel width="382" height="315" layout="absolute" horizontalCenter="4" verticalCenter="2.5" fontFamily="Verdana" title="eCTDViewer-Login">

              <mx:Label x="25" y="49" text="UserName "/>
              <mx:TextInput x="115" y="47"/>
              <mx:Text x="25" y="98" text="Password"/>
              <mx:TextInput x="115" y="96" displayAsPassword="true"/>
              <mx:Button label="Login" horizontalCenter="-80" verticalCenter="42.5" textRollOverColor="#408080" />
              <mx:Button x="186" y="169" label="Cancel" textRollOverColor="#408080"/>
              <mx:Label x="10" y="-26" text="eCTDViewer-Login" width="310" height="23" enabled="true"/>
              </mx:Panel>

              </mx:Application>
              /**************************************************************/

              and in now i am calling login.jsp in IE 7.0 as url= http://localhost:8080/flex/login.jsp

              it is displaying login page exactly what i want, but after entering username,password when i click submit button it should go to HelloServlet, there in servlet i am just printing a message,
              but it is not going to HelloServlet, Please guide me how to do this. and what need s to be configured in web.xml,

              /**********************HelloServlet**************/

              import java.io.*;
              import javax.servlet.*;
              import javax.servlet.http.HttpServlet;

              public class HelloServlet extends GenericServlet {

              public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
              {
              res.setContentType("text/html");
              PrintWriter pw=res.getWriter();
              System.out.println("I can into HelloServlet");
              pw.println("<B>Hello!");
              pw.println("<B>Hi!");
              pw.close();
              }

              }

              }
              /**********************************************/
              /***********************web.xml**************/

              <?xml version="1.0" encoding="utf-8"?>
              <web-app id="WebApp_ID" version="2.4" xmlns=" http://java.sun.com/xml/ns/j2ee" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
              <servlet>
              <servlet-name>login</servlet-name>
              <servlet-class>HelloServlet</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>login</servlet-name>
              <url-pattern>/login</url-pattern>
              </servlet-mapping>
              </web-app>
              /******************************************/
              waiting for reply.
              • 4. Re: yet another HTTPService question
                kcell Level 2
                Dear Sandeep,

                don´t use uppercase letters, cause its the meaning for shouting in forums.

                please chekc your forum entry, i have already answered your questions.
                ( http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=582&threadid=1291004 )

                If you have any questions post it as answer in your forum entry.

                regards,
                kcell