Skip navigation
Currently Being Moderated

HTTP Server.Error.Request error on EXTERNAL SERVER

Aug 18, 2009 2:32 PM

I am fit to be tied! I have been battling this HTTP Server Request error for hours. I have read through the blogs, boards, and other sites with great information, however, I still fail to get my app working. Uggh! The application continues to fail.

 

Environment:

1. Using an external server

2. Have complete control over server

3. Running Coldfusion 8

4. Using Flex Builder 3

5. SQL 2005

 

Situation:

I am trying to create a simple connection between my Flex application, Coldfusion, and SQL 2005. I am taking baby steps and using a pre-tested example using Friends of ED Foundation "Flex for Developers" book detailing the following code examples.  My file DBtestCFM_app.html calls the swf file which calls the messageboard.cfm file and calls the crossdomain.xml file.

 

I have the crossdomain.xml file at the root of the mydomainname folder.

 

Flex MXML:

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="messageRequest.send()">

 

<mx:HTTPService id="messageRequest" useProxy="false" method="POST" resultFormat="e4x" url="http://mydomainname.com/flex/DBtestCFM_app.html">

<mx:request xmlns="">

<emailaddress>{emailaddress.text}</emailaddress>

<message>{message.text}</message>

<messagetopic>{messagetopic.text}</messagetopic>

<postername>{postername.text}</postername>

</mx:request>

</mx:HTTPService>


<mx:StringValidator id="nameSV" source="{postername}"

property="text" trigger="{btnSubmit}" triggerEvent="click"/>

<mx:StringValidator id="emailSV" source="{emailaddress}"

property="text" trigger="{btnSubmit}" triggerEvent="click"/>

<mx:StringValidator id="topicSV" source="{messagetopic}"

property="text" trigger="{btnSubmit}" triggerEvent="click"/>

<mx:StringValidator id="messageSV" source="{message}"

property="text" trigger="{btnSubmit}" triggerEvent="click"/>


<mx:VBox x="10" y="10">

<mx:DataGrid id="dgMessage" x="25" y="200"

dataProvider="{messageRequest.lastResult.posting}">

<mx:columns>

<mx:DataGridColumn headerText="Poster Name"

dataField="postername" width="200"/>

<mx:DataGridColumn headerText="Email Address"

dataField="emailaddress" width="200"/>

<mx:DataGridColumn headerText="Message Topic"

dataField="messagetopic" width="200" />

</mx:columns>

</mx:DataGrid>


<mx:TextArea height="100" width="400"

text="{dgMessage.selectedItem.message}"/>


<mx:Form x="25" y="10" width="500">

<mx:FormItem label="Your Name:"

required="true">

<mx:TextInput id="postername" />

</mx:FormItem>

<mx:FormItem label="Email Address:"

required="true">

<mx:TextInput id="emailaddress" />

</mx:FormItem>

<mx:FormItem label="Message Topic:"

required="true">

<mx:TextInput id="messagetopic" />

</mx:FormItem>

<mx:FormItem label="Message"

required="true">

<mx:TextArea id="message" />

</mx:FormItem>

<mx:Button id="btnSubmit" label="Submit"

click="messageRequest.send()"/>

</mx:Form>

</mx:VBox>



</mx:Application>

 

Messageboard.cfm

 

<cfprocessingdirective suppresswhitespace="yes" pageencoding="utf-8">

<cfif isDefined("emailaddress") AND isDefined("message")

AND isDefined("messageTopic") AND isDefined("postername") AND

emailAddress NEQ "" AND message NEQ "" AND messageTopic NEQ ""

AND postername NEQ "">

<cfquery name="addInfo" datasource="#application.dsn.name#" username="#application.dsn.user#" password="#application.dsn.pwd#">

INSERT INTO messageData(emailaddress, message, messagetopic,

postername) VALUES("#emailaddress#"," #message#"," #messagetopic#"," #postername#")

</cfquery>

</cfif>

<cfquery name="allInfo" datasource="#application.dsn.name#" username="#application.dsn.user#" password="#application.dsn.pwd#">

SELECT ID, emailaddress, message, messagetopic, postername

FROM messageData

</cfquery>


<cfxml variable="messageXML">

<posters>

<cfloop query="allInfo">

<cfoutput>

<posting>

<id>#id#</id>

<emailaddress>#emailaddress#</emailaddress>

<message>#message#</message>

<messagetopic>#messagetopic#</messagetopic>

<postername>#postername#</postername>

</posting>

</cfoutput>

</cfloop>

</posters>

</cfxml>

<cfoutput>#messageXML#</cfoutput>

</cfprocessingdirective>

 

Crossdomain.xml

 

<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM " http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>

<site-control permitted-cross-domain-policies="all"/> 

<allow-access-from domain="*" to-ports="*" />

<allow-http-request-headers-from domain=”*” headers=”SOAPAction”/>

</cross-domain-policy>

 

 
Replies
  • Currently Being Moderated
    Jan 9, 2012 1:08 AM   in reply to ajdove

    Hi All,

     

    I am using Flash Builder 4.6/AIR 3.1.0. I am using RESTful web service to get XML results and to display on my mobile application. I am getting the same below error when accessing the webservice from mobile app (Android - Galaxy Tab 7 inch).

     

    Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error # 2032"] URL: http://adfdevp.alshaya.com:7013/RESTEmployeeDetails-EmployeeDetails-co ntext-root/jersey/restlabhttp://adfdevp.alshaya.com:7013/RESTEmployeeDetails-http://adfdevp.alshaya.com:7013/RESTEmployeeDetails-EmployeeDetails-co ntext-root/jersey/restlabEmployeeDetails-context-root/jersey/restlab

     

    The same code is working in Flash Builder 4.6. I have checked Network Monitor to "Disabled" before deploying to mobile. What am i doing wrong here? I am pasting my code below-

     

     

    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView" xmlns:dao="dao.*"
      xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Script>
      <![CDATA[
       import mx.collections.ArrayCollection;
       import mx.collections.IList;
       import mx.collections.XMLListCollection;
       import mx.events.FlexEvent;
       import mx.rpc.events.FaultEvent;
       import mx.rpc.events.ResultEvent;
       import mx.rpc.xml.SimpleXMLDecoder;
       import mx.utils.ArrayUtil;
      
       import valueObjects.EmployeeDetail;
       [Bindable]
       private var myXml:XML;
      
       [Bindable]
       public var resultCollection:IList;
       public function handleXml(event:ResultEvent):void
       {
        var xmlListCollection:XMLListCollection = new XMLListCollection(event.result.children());
        var xmlListCollectionValues:XMLListCollection = new XMLListCollection(event.result.emp.children());
        var resultArray:Array = xmlListCollection.toArray();
        var resultArrayValues:Array = xmlListCollectionValues.toArray();
       
       
        var objEmployeeDetails:EmployeeDetail;
        var resultCollection:ArrayCollection = new ArrayCollection();
       
        var j:int = 0;
        for(var i:int=0;i<resultArray.length;i++){
        
         objEmployeeDetails = new EmployeeDetail();
         objEmployeeDetails.brand = resultArrayValues[j];
         objEmployeeDetails.division = resultArrayValues[j+1];
         objEmployeeDetails.email = resultArrayValues[j+2];
         objEmployeeDetails.employee_name = resultArrayValues[j+3];
         objEmployeeDetails.employee_number = resultArrayValues[j+4];
         objEmployeeDetails.grade = resultArrayValues[j+5];
         objEmployeeDetails.mobile = resultArrayValues[j+6];
         objEmployeeDetails.position = resultArrayValues[j+7];
        
         j = j + 8;
         resultCollection.addItem(objEmployeeDetails);
        
        }
        list.dataProvider = resultCollection;
        //return resultCollection;
       }
      
       public function handleFault(event:FaultEvent):void
       {
        //Alert.show(event.fault.faultDetail, "Error");             
       }
      
       protected function sesrchEmployee():void
       {
        xmlRpc.send();
       }

      
      ]]>
    </fx:Script>


    <fx:Declarations>
      <dao:EmployeeDAO id="srv"/>
     
      <mx:HTTPService id="xmlRpc"
          url="http://adfdevp.alshaya.com:7013/RESTEmployeeDetails-EmployeeDetails-co ntext-root/jersey/restlab"
          result="handleXml(event)"
          fault="handleFault(event)"
          resultFormat="e4x" showBusyCursor="true">
       <mx:request xmlns="">
        <data>{key.text}</data>
        <data>{key1.text}</data>
       </mx:request>
      </mx:HTTPService>
     
     
    </fx:Declarations>

    <s:navigationContent/>

    <s:titleContent>
      <s:VGroup width="100%">
      <s:HGroup width="100%">
       <s:Label top="40" paddingTop="10" paddingRight="13" height="29" text="Employee Name:"/>
       <s:TextInput id="key" width="559"/>
      </s:HGroup>
      <s:HGroup width="100%">
       <s:Label height="30" paddingTop="10" text="Employee Number:"/>
       <s:TextInput id="key1" width="100%"/>
      </s:HGroup>
     
      </s:VGroup>
    </s:titleContent>

    <s:actionContent>
      <s:Button icon="@Embed('assets/search.png')" click="sesrchEmployee()"/> 
    </s:actionContent>

    <s:List id="list" top="0" bottom="0" left="0" right="0" 
       change="navigator.pushView(EmployeeDetails, list.selectedItem)">
      <s:itemRenderer>
       <fx:Component>
        <s:IconItemRenderer label="{data.employee_name}"
             messageField="position">
        </s:IconItemRenderer>
       </fx:Component>
      </s:itemRenderer>
    </s:List>

    </s:View>

     

    Appreciate your quick response in this regard.

     

    Thanks,

     

    Murtaza Ghodawala

    Mobile: +965 97180549

    murtaza.ghodawala@alshaya.com

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 18, 2012 10:11 AM   in reply to Murtaza_Ghodawala

    Hi Murtaza,

     

    This could happen because the HTTPService cannot find the URL. Some things to try out:

    1. Is the service accessible at http://adfdevp.alshaya.com:7013/RESTEmployeeDetails-EmployeeDetails-co ntext-root/jersey/restlab? The URL looks suspect with "-context-root" in it.

    2. Take a look at the following page: http://cookbooks.adobe.com/post_Flex_Error__2032__Stream_Error-17265.h tml. It talks about catching the fault event and getting more info.

     

    Rohit

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points