PDA

View Full Version : Flex builder 2 beta 1 HTTPService problem


ry_mawby
02-28-2006, 06:42 PM
Im trying to get a simple HTTPService call to work.

To test it I am using a static xml file called test.xml. When I call the HTTPService on my local machine it works fine but when I upload the swf to the server it throws a wobbly - something along the lines of:

Error: code:Server.Error.Request string:'HTTP request error' detail:'Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false text="Error #2032: Stream Error. URL......

I was thinking it had something to do with flex-services.xml but I can't even find this file and can't find any examples of what this file should have as its contents.

Just out of interest I am then loading the contents of the xml into a richtexteditor for (hopefully) editing.

Thanks in advance.

ry_mawby
02-28-2006, 07:40 PM
I realised I'd made a schoolboy error.

Just needed to add the cross-domain.xml policy file and everything worked fine.

hangalot
02-28-2006, 08:43 PM
flex-services.xml is only needed if you are using the FES capabilities.

nahruk
03-06-2006, 12:45 PM
I'm new with Flex and don't know how to send an HTTP request to an URL pointing to a remote location in another computer.

Basically I'm trying to send a HTTP request to a remote computer with Cocoon installed. The entry actualitza1.xml reads the http request parameters and calls the PL procedures that access the database.

When it attemps to reach the specified url in the <mx:HTTPService> tag, it launches the following error:
"Security error accessing url"
When I debug the application, I get a Sandbox security violation... can anyone help me with this, please...

May I use a crossdomain.xml file somewhere in the remote computer??
May I write a destination entry in the Flex configuration files?

Any help will be appreciated
Thanks!


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" initialize="srvpost.send()">

<mx:Script>
<![CDATA[
import mx.controls.Alert;
]]>
</mx:Script>

<!-- Security error accessing url -->
<mx:HTTPService id="srvpost"
method="POST"
useProxy="false"
resultFormat="xml"
fault="Alert.show(event.fault.faultstring);"
result="myText.text=srvpost.result.toString()"
url="http://myIP:8888/curs/actualitza1.xml">
<mx:request>
<fdni>155959792</fdni>
<ftlf>971232323</ftlf>
<femail>[email protected]</femail>
</mx:request>
</mx:HTTPService>
</mx:Application>

hangalot
03-06-2006, 02:00 PM
you need a crossdomain policy file on the machine you are trying to access. go read up about crossdomain files (google: moock crossdomain)

flex_newbie
12-10-2007, 01:28 AM
I am new to flex, in fact this is my first attempt at doing anything with it. I am trying to retrieve XML data from a remote server and display it on a pie chart. I have created crossdomain.xml on the remote server, here are its contents:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false"/>
</cross-domain-policy>

Here is my flex code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="pollRequest.send()">
<mx:HTTPService id="pollRequest" url="http://www.mydomain.com/poll_result.xml" showBusyCursor="true" useProxy="false" />
<mx:Style>
PieSeries
{
fills:#F15E22, #A1CD44, #999999;
fontSize:8;
fontFamily: Arial, Helvetica;
fontWeigh:normal;
}
</mx:Style>
<mx:Panel title="{pollRequest.lastResult.title}" height="230" width="210" paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0" fontFamily="Arial" cornerRadius="0" verticalGap="0">
<mx:PieChart id="pieChart"
dataProvider="{pollRequest.lastResult.poll.option}"
showDataTips="true"
height="100%" width="100%" fontWeight="normal" fontFamily="Arial" fontSize="9"
paddingTop="0" paddingRight="0" paddingBottom="0"
>
<mx:series>
<mx:PieSeries field="Votes" nameField="Option" calloutGap="0" labelPosition="none">

</mx:PieSeries>
</mx:series>

</mx:PieChart>
<mx:Legend dataProvider="{pieChart}" fontSize="9" paddingBottom="0" paddingTop="0" markerHeight="5" markerWidth="5" fontWeight="normal" fontFamily="Arial" verticalGap="0"/>
</mx:Panel>
</mx:Application>

Here are the contents of poll_result.xml:

<?xml version="1.0" encoding="utf-8"?>
<poll>
<title>Poll Question?</title>
<option>
<choice>Choice 1</choice>
<value>6</value>
</option>
<option>
<choice>Choice 2</choice>
<value>3</value>
</option>
<option>
<choice>Choice 3</choice>
<value>1</value>
</option>
</poll>

I can tell that a request to the xml file on the remote server is being made, but no data is being pulled out. What am I doing wrong? Any help is appreciated.

nikunjnemani
11-18-2009, 01:21 AM
I think you should add resultFormat="e4x" to indicate that the expected result format is xml