Performace of httpservice
I have recently written a flex app that downloads some xml
data from a URL using HTTPService to call a php script and return
xml. This works fine as it is a v. simple app, but what if there
were many requests to this URL. A friend told me to use amfphp and
I am configuring it now, but I wonder would that be able to perform
well if it is an enterprise application.
Just need a few pointers here.
Thanks
Ed
I have recently written a flex app that downloads some xml
data from a URL using HTTPService to call a php script and return
xml. This works fine as it is a v. simple app, but what if there
were many requests to this URL. A friend told me to use amfphp and
I am configuring it now, but I wonder would that be able to perform
well if it is an enterprise application.
Just need a few pointers here.
Thanks
Ed
Similar Messages
-
Using a Variable in HttpService url attribute
I have a dynamic url defined below
public var forecastURL:String = "
http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat="
+ latitude + "&lon=" + longitude +
"&format=12+hourly&startDate=" + todaysDate +
"&numDays=" + numberDays + ""
I would like to use the var without the {} bind. The compiler
complains if the url is not surrounded in quotes. This should be
simple? How can I use a var within the url attribute without the
bind brackets?
<mx:HTTPService
id="forecastRequest"
url = "{forecastURL}" result="resultHandler(event)"
/>Not Possible..why don't you use the subtitle box instead of help url?
-
I am calling an HTTPService (id=data2php) which runs a php
script which creates an xml doc and puts it on my server. i then
call another HTTPService (id=feedRequest) which reads the xml doc.
i then try to populate a datagrid with the lastResult of my
HTTPService that reads the xml doc. My issue is that that the
HTTPService which reads the xml doc reads the previous incarnation
of the xml doc, not the newly created one that my HTTPService
(data2php) created. i've been manually going to the xml doc in my
browser and hitting refresh for my feedRequest HTTPService to read
the updated xml.
here is the mxml for the httpservice that reads the xml:
<mx:HTTPService id="feedRequest" url="
http://cfcdi.org/eric/dashboard/php/sales.xml"
result="feedResult(event)" resultFormat="xml" useProxy="false"/>
pretty straight forward.
(actually, once in a while it will read the updated
one)LittleMuscle,
Instead of binding to the lastResult property, I would
explicitly handle the result and fault events of the HTTPService
(the one that reads the newly created xml doc) and then manually
update an XMLListCollection for use as the datagrid's dp. That way,
you can at least walk through the debugger and see what's going on,
and force the second HTTPService to read only when you're sure the
newly created doc is ready.
Since you said it works sometimes and not other times, it
sounds like it's just a timing problem, sometimes the xml doc is
created quickly enough that the HTTPService grabs the new xml doc,
but if not, it's grabbing the old one. That would be my
guess. -
HTTPService or mx:RichTextEditor isn't working well - htmlText
Hello
I'm working with the component <mx:RichTextEditor/>
I have a big problem after the HTTPService send the code and stores it in database.
Every time I catch the htmlText from RichTextEditor, he is putting a strange tag. I need to clean these tags.
I send this HTML code (htmlText from RichTextEditor) and store in the database.
In another moment I want to retrieve this code and throw in a TextArea.- this is the objetives, but I had a problem with this.
Look my code:
<mx:RichTextEditor id="ds_noticia" title="Descrição da notícia"
width="80%" htmlText="{dgNotRequest.selectedItem.dsNews}" />
<mx:Button id="submit" label="{'ADD'}" click="finish()" />
//Script:
private function concluir():void{
newsService.send();
<mx:HTTPService id=" newsService " url=" class/class_news.php"
resultFormat="object" result="newsHandler(event)" fault="faultHandler(event)" method="POST" >
<mx:request xmlns="">
<ds_noticia><![CDATA[{ds_noticia.htmlText}]]></ds_noticia>
</mx:request>
</mx:HTTPService>
Whit firebug I can see the post:
ds_noticia<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Introdução as tecnicas inter latifundiarias</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Aplicabilidade e manutenbilidade da gestão de requisito de isotopo por molécula astridente:<B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Números</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">A tecnologia foi adotada pela Cast há mais de dois anos e chegou a ter mais de 200 servidores virtuais. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">O projeto de virtualização demorou seis meses para ficar pronto e foram gastos quase R$ 600.000,00 na compra de equipamentos, software, instalação e treinamento.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Sem a virtualização, a Cast gastaria com renovações e novas aquisições, isso sem considerar o aluguel de espaço físico e custos com energia.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Resultados</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Desde a implementação da virtualização foi possível reduzir o tempo de atendimento de serviços de dias para horas.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Essas ações são importantes para a empresa, a sociedade e, principalmente, para o planeta. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0"><B>Fonte: </B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Gilson Fabio Robles Bernichi - Administrador de Banco Dados</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">James Lima da Silva - Coordenador de Suporte ao Desenvolvimento</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">Leonardo Amorim de Araujo – Coordenador de Infraestrutura e Segurança</FONT></LI></TEXTFORMAT>
If I could save this code, it would be perfect!
BUT the answer, after HTTPService send the content and it is saved into database
now the HTTPService show other code, this is not the same first code sanded!
ds_news = '<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Introdução as tecnicas inter latifundiarias</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Aplicabilidade e manutenbilidade da gestão de requisito de isotopo por molécula astridente:<B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B></B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Números</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">A tecnologia foi adotada pela Cast há mais de dois anos e chegou a ter mais de 200 servidores virtuais. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">O projeto de virtualização demorou seis meses para ficar pronto e foram gastos quase R$ 600.000,00 na compra de equipamentos, software, instalação e treinamento.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Sem a virtualização, a Cast gastaria com renovações e novas aquisições, isso sem considerar o aluguel de espaço físico e custos com energia.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Resultados</B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Desde a implementação da virtualização foi possível reduzir o tempo de atendimento de serviços de dias para horas.</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Essas ações são importantes para a empresa, a sociedade e, principalmente, para o planeta. </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\"><B>Fonte: </B></FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><LI><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Gilson Fabio Robles Bernichi - Administrador de Banco Dados</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><LI><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">James Lima da Silva - Coordenador de Suporte ao Desenvolvimento</FONT></LI></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><LI><FONT FACE=\"Verdana\" SIZE=\"10\" COLOR=\"#0B333C\" LETTERSPACING=\"0\" KERNING=\"0\">Leonardo Amorim de Araujo ? Coordenador de Infraestrutura e Segurança</FONT></LI></TEXTFORMAT>'
who can help me ?
Who can imagine what is happened?
Who can understand why the flex put a tag (/) always before the sing (“)?
Thank you for help meThanks!!!!
This problem isn't with Adobe Flex. This problema is because PHP configuration at PHP.ini
When on, all ' (single-quote), " (double quote), \ (backslash) and NULL characters are escaped with a backslash automatically.
"Quando ligada, qualquer ' (aspas simples), " (aspas duplas), \ (barra invertida) e NULL será colocado uma barra-invertida antes (' vira \') automaticamente".
Is a tecnique of incripiting by PHP but this feature has been DEPRECATED as of PHP 5.3.0. As my Case.
LOOK the steps
1. Check php.ini into server:
a. Acess: /etc/php5/apache2/php.ini (In my case, i'm working with Linux-Umbuntu)
2. Verify the part that mentioned about eMagic quotes. It need be stay like fallow example:
; Magic quotes
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off
; Automatically add files before or after any PHP document.
auto_prepend_file =
auto_append_file =
; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header. To disable sending of the charset, simply
; set it to be empty.
; PHP's built-in default is text/html
default_mimetype = "text/html"
default_charset = "utf-8"
; Always populate the $HTTP_RAW_POST_DATA variable.
;always_populate_raw_post_data = On
3. If necessary and diferent, disable the magic Quotes in php.ini: Put (OFF) in the place where is (ON)
We need change this because:
Inconvenience, if the property is on, it will put in a strange caracter (\) before ("). It is bat when you need to save html code to keep the format of the text.
it change important datas into database
This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
The magic_quotes_gpc directive may only be disabled at the system level, and not at runtime. In otherwords, use of ini_set() is not an option.
FONTE: http://www.php.net/manual/en/security.magicquotes.php
thanks again. good luck -
Performace : SQL with CASE
Hi,
Why execution plan for SQL1 & SQL2 are same?
Is there any performace impact(as compare to normal select) if we put CASE statement in SQL?
SQL1
SELECT
CASE WHEN PCS_SKEY < 1 then NULL ELSE PCS_SKEY END PCS_SKEY,
CASE WHEN MDT_SKEY < 1 then NULL ELSE MDT_SKEY END MDT_SKEY,
CASE WHEN DLS_SKEY < 1 then NULL ELSE DLS_SKEY END DLS_SKEY,
CASE WHEN MVI_SKEY < 1 then NULL ELSE MVI_SKEY END MVI_SKEY
FROM F_REG
SQL2
SELECT
PCS_SKEY,
MDT_SKEY,
DLS_SKEY,
MVI_SKEY
FROM F_REGExplain Plan
SQL1:
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=ALL_ROWS 4 M 38755
TABLE ACCESS FULL SMMTDW.F_REG 4 M 64 M 38755
SQL2:
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=ALL_ROWS 4 M 38755
TABLE ACCESS FULL SMMTDW.F_REG 4 M 64 M 38755 -
How to send JSON data in HTTPService to PHP web service question
I'm using Flex 4 and a mx:HTTPService to send a JSON request to a php web service. I'm not sure if I'm sending the request correctly. Could someone look at the code below to see what I'm doing wrong?
thanks
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
width="100%" height="100%">
<fx:Declarations>
<mx:HTTPService id="service" url="https://my web service url/"
method="POST" resultFormat="text" result="onResult(event)" fault="onFault(event)">
</mx:HTTPService>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.adobe.serialization.json.JSON;
import mx.collections.ArrayCollection;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.Base64Encoder;
[Bindable]private var username:String = "[email protected]";
[Bindable]private var password:String = "the password";
[Bindable]private var accountNumber:String = "49055";
[Bindable]private var anticipatedDeliveryDate:Number = 20101115;
[Bindable]private var purchaseOrder:String = "#123 for retailer";
[Bindable]private var detailRecords:Array = new Array();
[Bindable]private var key:String = "abc123";
private function populateService():void {
populateProducts();
setRequestHeader();
setRequestData();
service.send();
private function setRequestHeader():void {
var encoder:Base64Encoder = new Base64Encoder();
encoder.insertNewLines = false;
encoder.encode(key);
service.headers["Authorization"] = "VIP " + key;
service.headers["Content-Type"] = "application/json";
private function setRequestData():void {
service.request.username = username;
service.request.password = password;
service.request.accountNumber = accountNumber;
service.request.anticipatedDeliveryDate = anticipatedDeliveryDate;
service.request.purchaseOrder = purchaseOrder;
service.request.detailRecords = detailRecords;
// caching test
var rnd : Number = Math.round(Math.random()*1000);
service.request.cacheOff = rnd;
private function populateProducts():void {
var prod1:Object = new Object();
prod1.itemCodeOrUPC = "00241";
prod1.itemDescription = "Budweiser Keg 1/2 BBL";
prod1.quantityOrdered = 2;
prod1.orderUOM = "Keg";
var prod2:Object = new Object();
prod2.itemCodeOrUPC = "00219";
prod2.itemDescription = "Budweiser 24/12 OZ CAN";
prod2.quantityOrdered = 4;
prod2.orderUOM = "Case";
detailRecords.push(prod1);
detailRecords.push(prod2);
private function onResult(event:ResultEvent):void
var json:Object = JSON.decode(event.result as String);
private function onFault(event:FaultEvent):void
trace("Fault: " + event.fault.faultString);
]]>
</fx:Script>
<mx:Panel width="95%" height="100%" color="#000000">
<mx:HBox width="100%">
<mx:Button label="Submit" click="{populateService()}"/>
</mx:HBox>
</mx:Panel>
</s:Application>Have you think abut using ActionScript in your Flex application? Or, you can write javascript to be proxy between your flash app and backend PHP web service?
Also, it seems that you will allow every customer's flash player to have a copy of secret code. I think it is dangerous design because an flv file can be easity decompiled. Therefore, you secret code can be found if it is not input by your end user and it is populated on your serverside script. -
ColdFusion Script not work with Httpservice
At first I use PHP to generate xml output on page then use
the data to my httpservice with resultformat e4x. Everything is
fine. But now I want to use coldfusion script since I'm planning to
use ColdFusion as my web server. I have this script located on my
server and generate the data in XML file then the XML file is used
in my web, loaded through httpservice.
My PHP code was like this :
<?php
define( "DATABASE_SERVER", "localhost" );
define( "DATABASE_USERNAME", "root" );
define( "DATABASE_PASSWORD", "" );
define( "DATABASE_NAME", "MyCinema" );
$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME,
DATABASE_PASSWORD) or die(mysql_error());
mysql_select_db( DATABASE_NAME );
$Query = "SELECT * FROM film";
$Result = mysql_query( $Query );
$Return = "<movies>";
while ( $film = mysql_fetch_object( $Result ) )
$Return .= "<film><judul>".$film->JUDUL.
"</judul><deskripsi>".$film->DESKRIPSI.
"</deskripsi><genre>".$film->GENRE.
"</genre><produser>".$film->PRODUSER.
"</produser><produksi>".$film->PRODUKSI.
"</produksi><homepage>".$film->HOMEPAGE.
"</homepage><durasi>".$film->DURASI.
"</durasi><url>".$film->URL."</url></film>";
$Return .= "</movies>";
mysql_free_result( $Result );
print ($Return);
?>
And now I try to get the same result using coldfusion script.
At first I dont write the XML to file, I just cfoutput it just like
I do with PHP just print result but it doesnt work out with my
HTTPservice. Until I try to write it to XML file then coding my
httpservice to read directly from that XML file. here is my
coldfusion code.
<cfcomponent>
<cffunction name="a" returnType="Void" output="true"
access="remote">
<cfprocessingdirective suppresswhitespace="Yes">
<cfquery name="GetFilm" datasource="myCinemaData">
SELECT b.* FROM playing a, film b
WHERE a.kode_film=b.kode_film AND a.start >
<cfqueryPARAM value = "#DateFormat(Now())#"
CFSQLType = "CF_SQL_STRING">
</cfquery>
<cfxml variable="userXML">
<movies>
<cfloop query="GetFilm">
<cfoutput>
<film>
<judul>#GetFilm.JUDUL#</judul>
<deskripsi>#GetFilm.DESKRIPSI#</deskripsi>
<genre>#GetFilm.GENRE#</genre>
<produser>#GetFilm.PRODUSER#</produser>
<produksi>#GetFilm.PRODUKSI#</produksi>
<homepage>#GetFilm.HOMEPAGE#</homepage>
<durasi>#GetFilm.DURASI#</durasi>
<url>#GetFilm.URL#</url>
</film>
</cfoutput>
</cfloop>
</movies>
</cfxml>
</cfprocessingdirective>
<cffile action="write"
file="#expandPath(".")#\userXML.xml" output="#userXML#">
</cffunction>
</cfcomponent>
Because I need to create the XML files first I try to execute
this coldfusion script first using webservice before I execute my
Httpservice but the XML file creation is slower than the execution
of my httpservice afterthat so it shows an error that my XML file
isn't not available. What can i do? I've tried to show the output
using cfoutput and run that script directly on my httpservice just
like the way I use print result on PHP but it produce an
error.... I try to execute this coldfusion script first using
webservice before I execute my Httpservice but the
XML file creation is slower than the execution of
my httpservice afterthat so it shows an error
that my XML file isn't not available.
Then it might help to apply a named lock to ensure that the
Httpservice runs only after the web service call is complete. For
example, apply an exclusive named lock on the code that calls the
web service and a readonly lock of the same name to the Coldfusion
code that interacts with the Httpservice. -
Hi There,
I am new to FLEX and also new to writing a client for a web service.
My question is more about flex (Flash builder 4.5) APIs, what APIs to use.
I want to access a web service, that's published here.
https://build.phonegap.com/docs/write_api
here is the description of webservice
===========
1) I have to do a post on POST https://build.phonegap.com/api/v1/apps
2) content type has to be "multipart/form-data"
3) JSON bodies of requests are expected to have the name 'data'
data will be someting like this
'data={"title":"API V1 App","package":"com.alunny.apiv1","version":"0.1.0","create_method":"file"}'
4) include a zip file in the multipart body of your post, with the parameter name 'file'.
===========
I want to make a 'multipart/form-data' Post and send
one string and one zip file.
My first question to self was If i send both string + binary data in the body ...
how will server understand where string end and where zip file starts?
Then read on W3.org( http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 )
How is text + binary data can be sent through "multipart/form-data" post requst.
there has to be some boundries.
After this I read and example in flex and tried following it.
http://codeio.wordpress.com/2010/04/03/5-minutes-on-adobe-flex-mimic-file-upload-for-in-me mory-contents/
but it doesn't seems to be working for me.
public function createNewApp(cb:Function , appFile : File):void
var service:HTTPService = new HTTPService();
service.url = ROOT+"apps";
service.showBusyCursor = true;
service.addEventListener(ResultEvent.RESULT, function(e:ResultEvent):void {
//translate JSON
trace(e.result);
var result:String = e.result.toString();
var data:Object = JSON.parse(result);
cb(data.link);
service.addEventListener(FaultEvent.FAULT, defaultFaultHandler); //todo : allow user to add his own as well
authAndUploadNewApp(service,appFile);
private function authAndUploadNewApp(service:HTTPService,appFile : File):void {
var encoder:Base64Encoder = new Base64Encoder();
encoder.encode(username + ":"+password);
service.headers = {Accept:"application/json", Authorization:"Basic " + encoder.toString()};
service.method ="POST";
var boundary:String = UIDUtil.createUID();
service.contentType = "multipart/form-data; boundary=—————————" + boundary;
var stream:FileStream = new FileStream();
stream.open(appFile, FileMode.READ);
var binaryData:ByteArray = new ByteArray();
var fileData : String = new String();
stream.readBytes(binaryData);
stream.close();
fileData = binaryData.readUTFBytes(binaryData.bytesAvailable); // I think this is where I have problem.... how do
//how do i converrt this bytearray/stream of data to string and send it in my post request's body - i guess if this step work rest should work..
var params: String = new String();
var content:String = "—————————" + boundary + "nr";
content += 'Content-Disposition: form-data; name="data";' + '{"title":"ELS test app 2","package":"com.elsapp.captivate","version":"12.3.09","create_method":"file"}' + "nr";
content += "—————————" + boundary + "nr";
content += 'Content-Disposition: form-data; name="file";' + fileData + "nr";
content += "—————————–" + boundary + "–nr";
service.request = content;
service.send();In the past I have used URLVariables with URLRequest and URLLoader to achieve this kind of requirement.
Check out http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_3 .html which should be useful. My preference has always been to use this style instead of HTTPService objects, giving you a little more control which is what you need here.
Let me know if you need any more assistance. -
Loading Textual Data from HttpService Would Not Show Up on TextArea
Hi,
I have something fairly strange here that I have a little problem getting it to work. I am loading some data from XML and attempt to format it a little more on Actiosncript and print it out on the TextArea. For some reason, it would not show up, even though when I used Alert.show it does spit out the entire xml data set. Based on this, I know my data has been loaded correctly, but I am not sure why it is not showing up on my page.
Here is the code,
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:states>
<mx:State name="view">
<mx:RemoveChild target="{intro}"/>
<mx:AddChild relativeTo="{applicationcontrolbar1}" position="before">
<mx:TextArea editable="false" id="viewText" width="450" height="279" text="{messageInfo}"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Script>
<![CDATA[
import mx.events.ItemClickEvent;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
[Bindable]private var message:XMLList;
[Bindable]private var messageInfo:XMLList;
private var savedIndex:int = 99999;
private function clickHandler(event:ItemClickEvent):void {
if (event.index == savedIndex) {
//don't do a thing
else {
savedIndex = event.index;
navigateToURL(new URLRequest("../"+ event.item.data));
private function toggleButtonBar_itemClick(evt:ItemClickEvent):void {
currentState = evt.item.data;
if(evt.item.data == "view") view();
private function view():void{
currentState="view";
userView.send();
private function httpService_fault(evt:FaultEvent):void {
var title:String = evt.type + " (" + evt.fault.faultCode + ")";
var text:String = evt.fault.faultString;
Alert.show("There is an error! Type " + title + " " + text);
private function httpService_result(evt:ResultEvent):void {
messageInfo = XML(evt.result).messages.message;
Alert.show(messageInfo);
message = XML(evt.result);
var message_name:String = "";
var message_phone:String = "";
for each (var message:XML in messageInfo.messages.message) {
viewText.text += "Name " + messageInfo.name + "\n";
viewText.text += "Phone " + messageInfo.phone + "\n";
]]>
</mx:Script>
<mx:HTTPService id="userView" url="messages.xml" resultFormat="e4x"
fault="httpService_fault(event);" result="httpService_result(event)" />
<mx:PhoneNumberValidator id="pnVal" source="{your_phone}" property="text"/>
<mx:EmailValidator id="emailVal" source="{your_email}" property="text"/>
<mx:Array id="dp">
<mx:Object data="view" label="View"/>
</mx:Array>
<mx:Panel id="panel" title="My Home" height="70%">
<mx:TextArea id="intro" width="77%" height="100" borderStyle="none" paddingLeft="10" color="black">
<mx:htmlText><![CDATA[Welcome to my page.]]></mx:htmlText>
</mx:TextArea>
<mx:ApplicationControlBar id="applicationcontrolbar1">
<mx:ToggleButtonBar id="toggleButtonBar" color="#FFFFCC"
dataProvider="{dp}"
itemClick="toggleButtonBar_itemClick(event);" />
</mx:ApplicationControlBar>
</mx:Panel>
</mx:Application>
Note, there are other items in the array, but those are not relevant to the question of the topic here, and therefore I am not posting the code for those sections.
When I click on the View button, it does give me the correct state, but I get a blank box of textArea with no data when I know there is output from Alert.show in the view(). What have I missed?
Thanks for your help.Thanks for the pointer. As a matter of fact, I found out that it is because of my xml nodes messing up, and that the text was displayed as white for someb reason. With a white background, of course I would not see a thing.
Thanks again. -
I would like to create child components of the component
based on a XML which is retrieved by WebService/HttpService call.
createChildren() is the one to be used to create components
dynamically. But if I use createChildren() and call a
WS/HttpService request in createChildren method, I can not get the
result of WS/HttpService request in createChildren().
It seems that the result event is processed later after
createChildren() is completed.
How can I implement my requirement?
I would appreciate any pointer or suggestion.
Best regards
Masa1) Use a List, with a custom itemRenderer
2) Use a Repeater (Probably easiest)
3) use Actionscript to addChild() components.
Tracy -
Using HTTPService to import data from a XML file
Hello there!
I'm having some problem's with this import... If anyone can
help, I would appreciate it!
I'm using this type of information as data source:
public var dataCollection:ArrayCollection =
new ArrayCollection([
{ id: "P1", name: "Porto", type: "team", children: [
{ id: "R1", name: "Dr Silva", location: "Bloco 1", type:
"member" },
{ id: "R2", name: "Dra Neto", location: "Gabinete", type:
"member"
{ id: "P2", name: "Braga", type: "team", children: [
{ id: "R3", name: "Dr Santos", location: "Bloco 2", type:
"member" },
{ id: "R4", name: "Dra Sonia", location: "Piso 1", type:
"member"
But I want to import it from a XML file like this:
<?xml version="1.0" encoding="utf-8"?>
<items>
<item id="P1" name="Porto" type="team">
<children id="R1" name="Dr Silva" location="Bloco 1"
type="member" />
<children id="R2" name="Dra Neto" location="Gabinete"
type="member" />
</item>
<item id="P2" name="Braga" type="team">
<children id="R3" name="Dr Santos" location="Bloco 2"
type="member" />
<children id="R4" name="Dra Sonia" location="Piso 1"
type="member" />
</item>
</items>
I already import the file, but can not translate the data
into a array collection.
private function initApp():void {
var httpService:HTTPService = new HTTPService();
httpService.url = "dataprovider.xml";
httpService.resultFormat = "e4x";
httpService.addEventListener(FaultEvent.FAULT,
onFaultHttpService);
httpService.addEventListener(ResultEvent.RESULT,
onResultHttpService);
httpService.send();
private function onFaultHttpService(e:FaultEvent):void
Alert.show("Error reading data file.");
private function onResultHttpService(e:ResultEvent):void
//Convert the xml data to a array collection
Thank youHello Peter, and thank you for your reply's.
My problem is that I'm receiving the data from the external
file and I don't know how to get the children in place... I mean, I
also have some data being received form a file that I can convert
into an array collection, but the thing is, that file doesn't have
children structure...
It's something like this:
<?xml version="1.0" encoding="utf-8"?>
<items>
<item id="T1" resourceId="R1" name="Cardiologia"
startTime="25-3-09 8:0:0" endTime="25-3-09 8:30:0" />
<item id="T2" resourceId="R2" name="Raio-X"
startTime="25-3-09 9:0:0" endTime="25-3-09 9:15:0" />
<item id="T3" resourceId="R3" name="Analises"
startTime="25-3-09 12:0:0" endTime="25-3-09 12:45:0" />
<item id="T4" resourceId="R4" name="Consulta"
startTime="26-3-09 8:0:0" endTime="26-3-09 9:0:0" />
</items>
And I solve it with this (don't know if is the best):
private function onResultHttpServiceTask(e:ResultEvent):void
var a:Array = xmlListToObjectArray(e.result.item);
tasks = new ArrayCollection(a);
protected function
xmlListToObjectArray(xmlList:XMLList):Array
var a:Array = new Array();
for each(var xml:XML in xmlList)
var attributes:XMLList = xml.attributes();
var o:Object = new Object();
for each (var attribute:XML in attributes)
var nodeName:String = attribute.name().toString();
var value:*;
value = attribute.toString();
o[nodeName] = value;
a.push(new ObjectProxy(o));
return a;
But when the children "enter in action" I don't know how to
bring them to the array...
This code you send it's preaty much the thing I need, but the
thing is that I don't know how to call the children with data as
e:ResultEvent...
If you can help a bit more, I would really appreciate...
Thank You -
Error loading data from an XML file using HTTPService
Hello All,
I have a runtime error that has got me beat at the moment I am building an App in Flash Builder 4 to run on AIR.
The error is as follows: TypeError: Error #1009: Cannot access a property or method of a null object reference.
What i'm Trying to Do:
I have 2 DropDownList controls, the first is populated with country names and the other with language options. All the 1st DropDownList control does
is set an image control to display the country flag and enable the 2nd DropDownList.
The 2nd DropDownList sets the langCode variable equal to the chosen language code. I then call the language function and pass it langCode. Using this variable, I build up the string
so that langFilePath will be equal to the XML file (which is "Lang_GBR.xml") location on my desktop and then call the HTTPService.
As soon as the language function is called, the runtime error occurs and highlights the line with btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu;
where I try to assign the button label with a new value from the XML file.
I suspect this may be a trivial error but I just can't see it at the moment.
Any help or guidance would be appreciated. Thanks
Code:
<fx:Script>
<![CDATA[
[Bindable]
public var langFilePath:String;
public var langDir:File = File.desktopDirectory;
public var langCode:String;
public function countrySelect_changeHandler(event:IndexChangeEvent):void
switch (countrySelect.selectedItem)
case ('United Kingdom'):
trace("Item Selected was: "+ countrySelect.selectedItem);
img_countryFlag.source = AngolaFlag;
break;
case ('France'):
trace("Item Selected was: "+ countrySelect.selectedItem);
img_countryFlag.source = AustraliaFlag;
break;
default:
break;
langSelect.enabled = true;
trace("1st dropdownbox");
public function langSelect_changeHandler(event:IndexChangeEvent):void
switch (langSelect.selectedItem)
case ('English'):
trace("Language Selected was: "+ langSelect.selectedItem);
langCode = "Lang_GBR";
break;
case ('French'):
trace("Language Selected was: "+ langSelect.selectedItem);
langCode = "Lang_FRA";
break;
language(langCode);
public function language(aParam:String):void
trace("Code Was: " + aParam);
trace("Lang dir: " + langDir.nativePath);
langFilePath = langDir.nativePath + "/" + aParam + ".xml";
trace("File to load: " + langFilePath);
trace("loadLangFile.url: " + loadLangService.url);
loadLangService.send();
btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu;
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="loadLangService" url="{langFilePath}"/>
</fx:Declarations>
<s:DropDownList x="10" y="201" id="countrySelect" prompt="Please Select Your Country" width="274" enabled="true" change="countrySelect_changeHandler(event)">
<s:DropDownList x="10" y="348" id="langSelect" prompt="Please Select Your Language" width="274" enabled="false" change="langSelect_changeHandler(event)">Don't sure about your XML structure, but for now i see the problem here between this 2 lines of code:
loadLangService.send();
btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu;
Think data that your httpService should receive just can't go so fast to populate the lastResult before you call it in the next line
Try adding a result listener to your service before you send it:
loadLangService.addEventListener(ResultEvent.RESULT, handler);
loadLangService.send();
function handler(event:ResultEvent):void {
btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu; -
HTTPService problems while sending a String Variable to Server
I have an xml in string form..... I want to send it as an http request to the server, which is written in .NET... server wud make its decession on the basis of this xml and wud return me another xml as http response..
Problem ---->
this request reaches server but when i look at the request reached at server it has my client infotmation but does not has my variable anywhere...... i iterate through all the parameters in Request.Params... but I don't find my string at all.... any idea why I can't find my sent variable ???
Actionscript code to send xmlString to .NET Server using HTTPService:
public function sendRequest(syncXmlString : String, httpResultHandler : Function) : void {
try {
var objectParam : Object = {name:PARAM_NAME, value:syncXmlString };
var params : Object = [objectParam];
var httpService : HTTPService = new HTTPService();
httpService.url = serverUrl;
httpService.method = HTTPRequestMessage.POST_METHOD;
httpService.contentType = HTTPService.CONTENT_TYPE_XML;
httpService.resultFormat = HTTPService.RESULT_FORMAT_XML;
httpService.addEventListener(ResultEvent.RESULT, httpResultHandler);
httpService.addEventListener(FaultEvent.FAULT, httpFaultHandler);
httpService.send(params);
} catch (err : Error) {
Alert.show(err.message);
Thanks and Regards,
Ahmed.No, that is the problem, the request object should not be an indexed array[], it should be an Object{}. Remove that imtermediate array and pass objectParams in the send()
Also, don't mess with the contentType without very good reason.
httpService.contentType = HTTPService.CONTENT_TYPE_XML;
that says you are sending XML, but you are not, you are sending the default name=value pairs. Remove that assignment and leave it at the default "form"
One more, you do not want that resultFormat, it is the legacy AS2 class. You want E4X
httpService.resultFormat = RESULT_FORMAT_E4X;
Tracy -
Error while issuing an httpService from a local swf
We have a swf that includes a Flex HTTPService call to check for
tomcat status. This call is resulting to below error:
Error #2028: Local-with-filesystem SWF filefile:///C:/......./click.swfcannot access Internet URLhttp://localhost:8600/.../dummy.html."
We are able to get over this error by adding this click.swf as "Always Allow"
at http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.ht ml#119065
However, in production environment it is not feasible to do this manual step.
We would want to know if there is a way to let the flash player know that this is trusted
by modifying any config file of Flash player or flex.
Please suggest. Any pointers on resolving this is greatly appreciatedMake sure you use -use-network=true. Or AIR.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Error while calling HTTPService
i am getting [RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"] error while trying to call a htttpservice.
the following is the code which i am using to call the httpservice. my flex app and the http service which i am trying to call is located on the same server. if i paste the URL in the browser and click enter i was able to retreive the data.
but when i use the same URL in the flex its not working. i tried using an application called HTTPanalyzer which logs all the http requests
made by all the applications.but i couldnt find the flex app making any call to the server at all. i.e. its not actually sending request at all.please help me
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.*;
import mx.collections.*;
import mx.managers.PopUpManager;
import mx.core.Application;
import mx.events.*;
[Bindable]
private function passKeys():void{
var params:Object={};
params["bu"]=bu.text.toUpperCase();
params["poid"]=poID.text.toUpperCase();
params["poget"]=Application.application.poadd.poMetaData.toXMLString();
Alert.show(http_createPO.url);
Application.application.mode="A";
http_createPO.send(params);
]]>
</mx:Script>
<mx:HTTPService id="http_createPO" showBusyCursor="true" url="http://xxxx.com/WEBLIB_FX_DOC.SM_FX_PO.FieldFormula.IScript_createPO" result="Application.application.getPO(event)" resultFormat="xml" fault="Alert.show(event.fault.toString())"/>
<mx:Button x="134" y="68" label="Create PO" id="createPO" click="passKeys()"/>
<mx:TextInput x="166" y="11" id="bu" keyUp="autocomplete(this.bu,event)" fontWeight="bold"/>
<mx:TextInput x="166" y="37" id="poID" text="Next" fontWeight="bold" maxChars="8"/>
</mx:TitleWindow>Thanks for the reply guys.
i had it working.i have not changed anything from the code perspective i tried deleting browser cache and server cache.but its working only on some machines..any iddea guys?
Maybe you are looking for
-
DVCPRO HD Varicam capture of 720/24p (not 23.978)
Hi, I was hoping someone could help me, im hiring in a AJHD-1400 deck to digitise some footage shot on the AJ-HDC27 Varicam. It was shot at 720/24p at 60hz meaning that the frame rate is true 24fps not 23.978fps. I had limited access to one a while b
-
My iphone 5 is stuck in recovery mode loop for 3 days, how can i fix this? I have attempted to reboot by pressing the home and power key at the same time. I have also tried to put in DFU mode and then plugin to my Mac and computer is not recognizing
-
I try downloading the ios7 and it keeps saying there is an error
Everytime I try downloading it says error occurred check setting but there's nothing wrong with any of my settings
-
Do we apply CPU or PSU patches to the database or to the oracle binaries. If we apply to oracle binaries does it effect to all the databases. Is there any pathes that are only for database. Please let me know. Thank you!
-
Flash Builder 4.5 newbie help
Hey guys, Thank you for taking the time to read my post and help me out. I am currently just learning actionscript 3 and I have been using flash professional in order to program most of my first flash programs, I would like to take one of my ideas