Receive PHP Object through HTTP Service in Flex
Hi,
I want to get a PHP Array through HTTPService and access it in Flex. How can I do this.
I am trying to get an Array which is in the form of a tree from PHP. I want to receive this Array and convert it into a Flex Arraycollection, so that I can diaply it in an Advanced Datagrid.
See this web site:
http://www.switchonthecode.com/tutorials/flex-php-tutorial-transmitting-data-using-json
You'll need this ActionScript library:
http://code.google.com/p/as3corelib/downloads/list
Put as3corelib.swc somewhere and then go to Flex Builder menubar Project - Properties, then to Flex Build Path - Library Path tab, Add SWC, and provide the path to your as3corelib.swc.
If this post answers your question or helps, please mark it as such.
Similar Messages
-
Change this to an XML array collection with an HTTP service in flex 3.0
I need to change this to an XML array collection with an HTTP
service in flex 3.0
private var flatData:ArrayCollection = new ArrayCollection([
{ Country:"India", State:"Karnataka", Region:"South-West",
Company:"Horizon", Product:"flexo",
Year:"2000", Quarter:"Q1", Month:"Jan", Sales:-10, Cost:5,
Production: 20 },
{ Country:"India", State:"Tamil Nadu",
Region:"South-East",Company:"Horizon", Product:"flexo",
Year:"2000", Quarter:"Q1", Month:"Mar", Sales:10, Cost:5,
Production: 20 },
{ Country:"India", State:"Kerala", Region:"South-West",
Company:"Horizon", Product:"flexo",
Year:"2000", Quarter:"Q4", Month:"Nov", Sales:10, Cost:5,
Production: 20},
{ Country:"India", State:"Assam", Region:"North-East",
Company:"Horizon", Product:"Trinetra",
Year:"2000", Quarter:"Q1", Month:"Feb", Sales:40, Cost:20,
Production: 20 },
{ Country:"India", State:"Kerala", Region:"South-West",
Company:"Horizon", Product:"Trinetra",
Year:"2000", Quarter:"Q4", Month:"Dec", Sales:55, Cost:27.5,
Production: 20 },
{ Country:"India", State:"Karnataka", Region:"South-West",
Company:"Horizon", Product:"Trinetra",
Year:"2000", Quarter:"Q2", Month:"Apr", Sales:20, Cost:10,
Production: 20 },
// confusion
{ Country:"India", State:"Delhi", Region:"North-East",
Company:"Confusion", Product:"Besto",
Year:"2000", Quarter:"Q1", Month:"Jan", Sales:20, Cost:10,
Production: 20 },
{ Country:"India", State:"Orissa", Region:"South-East",
Company:"Confusion", Product:"Besto",
Year:"2000", Quarter:"Q1", Month:"Feb", Sales:10, Cost:5,
Production: 20 },
{ Country:"India", State:"Gujrat", Region:"North-West",
Company:"Confusion", Product:"Besto",
Year:"2001", Quarter:"Q4", Month:"Oct", Sales:50, Cost:25,
Production: 20 },
{ Country:"India", State:"Delhi", Region:"North-East",
Company:"Confusion", Product:"Besto",
Year:"2001", Quarter:"Q4", Month:"Nov", Sales:60, Cost:30,
Production: 20 },
{ Country:"India", State:"Tamil Nadu",Region:"South-East",
Company:"Confusion", Product:"Besto",
Year:"2001", Quarter:"Q4", Month:"Dec", Sales:70, Cost:35,
Production: 20},
{ Country:"India", State:"Gujrat", Region:"North-West",
Company:"Confusion", Product:"Best",
Year:"2000", Quarter:"Q1", Month:"Mar", Sales:30, Cost:15,
Production: 20 }
can u pls tell meCreate a uriTemplate like this
/auth?uname={uname}&pass={pass}
use GET method only.
generate the personalization keys. -
Sending xml data through http services in adobe air
Hello every one,
I am stucked with a problem using httpservices,
Here's my code
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="login();">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
private var reqData:XML = new XML();
protected function userRequest_resultHandler(event:ResultEvent):void
// TODO Auto-generated method stub
Alert.show(event.result.toString());
private function login():void
trace("username " +username.text)
trace("password " +password.text)
trace("request"+userRequest.request.toString());
reqData =<ApplicationReq>
<InsType>"1"</InsType>
<RequestType>"3"</RequestType>
<TrackID>"22222222"</TrackID>
<Mode>"2"</Mode>
<ApplicationID>"11"</ApplicationID>
<CompanyID>"1"</CompanyID>
</ApplicationReq>
var params:Object = {};
params["username"] = "admin";
params["password"] = "admin@123";
userRequest.send();
//userRequest.send();
protected function userRequest_faultHandler(event:FaultEvent):void
// TODO Auto-generated method stub
Alert.show(event.fault.toString());
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:HTTPService id="userRequest" url="http://ins.dgsecure.com/gui/xmltest3.php"
useProxy="false" method="POST"
result="userRequest_resultHandler(event)"
resultFormat="xml" fault="userRequest_faultHandler(event)">
<s:request xmlns="">
<ApplicationReq>
<InsType>"1"</InsType>
<RequestType>"3"</RequestType>
<TrackID>"22222222"</TrackID>
<Mode>"2"</Mode>
<ApplicationID>"11"</ApplicationID>
<CompanyID>"1"</CompanyID>
</ApplicationReq>
</s:request>
</s:HTTPService>
</fx:Declarations>
<s:TextInput id="username" x="441" y="160" />
<s:TextInput id="password" x="442" y="196"/>
<s:Button x="459" y="244" label="login" click="login()"/>
</s:WindowedApplication>
if i set the content type to"application/xml " its giving RPC error, else if the data going to the server through encoding like Xmlrequest = %&ddgG&&ddjkjdj3d
how to getout of this problem and how can i send the total xml data with http requestHi,
Xcelsius/Dashboards will convert the range of values that you want to send into XML.
It then will POST the XML when it calls the web page.
For example, if you had created three ranges to send to your web page:
A (a single cell)
B (a single cell)
C (a row of three cells)
The data in the POST input stream for the web page will look something like this:
<data>
<variable name="A">
<row>
<column>10</column>
</row>
</variable>
<variable name="B">
<row>
<column>15</column>
</row>
</variable>
<variable name="C">
<row>
<column>1</column>
<column>2</column>
<column>3</column>
</row>
</variable>
</data>
I don't have an example for ASP, but I do for a JSP (attached).
Regards
Matt -
How to handle HTTPS Service that returns XML
When using Flash + AMF remoting I've always typecast the event.result as XML(event.result). Typecasting isn't working in Flash Builder, I'm getting an object as the result [object MYXMLROOT] and I can access it's properties, but I can't typecast it as XML, nor can I loop each of it's properties....
Hi,
There are ways to use XML returned by Http Service in flex. Is this what you are looking to achieve?
http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservic e-tag/
The DCD features of Flash Builder 4 can also be used to access the XML as Services.
Nishad -
In sap 4.7 ver i want to dispatch an Idoc through http in xml format
Hi
Here i am giving the brief scenario of about my
requirements "::::
Our organization need to receive an IDoc through
HTTP into XML format then we have to send an acknowledgement back to USA (external system
located)
then we hav eto process tha tIDoc an dsend it back
to the edi 850 ...
we are not using Sap Business Connector
Plz send the suggestions as soon as possible
I really appreciated if u can give the suggestions
regarding my business scenario ..
without using any thirdparty tool in sap 4.7 version it is possible how can i do that ??
Thanks & Regards ,
bakThe exact error message I'm getting is :
ABAP XML formatting error in XML node of type "element", name: "abap" -
Https service doesn't works through CSS
I have 2 CSS 11501, and they work fine.
The only problem that has is that it doesn't work one of the content HTTPS.
This is the configuration that I have:
service server54
ip address 172.16.10.46
keepalive port 443
keepalive type tcp
active
service server55
ip address 172.16.10.146
keepalive port 443
keepalive type tcp
owner https
content web
vip address 10.102.1.28
add service server54
port 443
protocol tcp
application ssl
advanced-balance ssl
add service server55
active
group web
vip address 10.102.1.28
add service server52
add service server53
add service server54
add service server55
active
I've left only one of the services active. In the CSS I see the requests but no package comes to the server.
The http service has the same addresses and does not have any problem.
What can happen?Hello,
Did you check that the service is alive? (CSS# show service summary)
Did you check that the CSS is showing service hits for that content rule? (CSS# show summary) when you are doing requests?
If the users are the ones that are opening the connections, please change the group configuration:
group web
vip address 10.102.1.28
add destination service server52
add destination service server53
add destination service server54
add destination service server55
active
After trying all above, if you keep having the problem, the best way to know what is happening is get simultaneous captures, in the switch(s) where the CSS is directly connected, and you will see the CSS receiving the traffic, and forwarding the traffic to the backend servers.
You will confirm or at least you will see if the CSS is not the problem.
- Rodrigo. -
Http service component working php and sql data
hello i'm using that componet. i have trouble. now i want in my home page
i have 2 title from my localhost/phpmyadin. and i want when click title 1 it will link to a detail.mxml and display content of title 1
and when click title 2 it will display content of title 2 in detail.xml
i don't know transmission parameters . Can u help me please. I'm need itThese links are good for showing how to use Flex + PHP + HTTPService + MySQL:
http://www.switchonthecode.com/tutorials/using-flex-php-and-json-to-modify-a-mysql-databas e
If this post answers your question or helps, please mark it as such.
http://www.switchonthecode.com/tutorials/flex-php-tutorial-transmitting-data-using-json
http://www.switchonthecode.com/tutorials/flex-php-json-mysql-advanced-updating
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex Training and Support Services -
Hi,
I am trying to Integrate Flex with Hibernate and want to use
Http Service to communicate with the back end. Most of the related
articles I read mention about Flex Data services. But I don't want
to use them.
Is it possible to build an application that integrates with
Hibernate without using Data services?
Thanks in advanceHi,
Yes you can do that. Create a servlet/JSP page which will
invoke the Hibernate classes and give the URL to the servlet/JSP to
the HTTPService component.
Hope this helps. -
Consume the sample web services developed in java in Apex through https.
I am trying to consume a webservice (developed in java) in Apex through https.I get an error stating " wallet needs to be configured"
I have done the following things till now.
Steps:
1.Created a new wallet using Oracle Wallet manager.
2.Created a certificate request; took an export of the same; downloaded a trial SSL certificate form thawte.com.
This download SSL certificate is created using the certificate request which was created earlier.
3. Imported the trial SSL certificate to the wallet.
4.Saved the wallet to a file.
5.Logged in Apex Admin user and in the Instance settings section, specified the wallet directory path to the directory which contains the wallet.
Any suggestions?
Thanks,
Anish ThomasHi,
please try the stand alone OC4J. Due to its configuration, the embedded OC4J overrides all settings when you run an application. This means that the SSL setting is basically wiped out. So best is to set this up on stand alone OC4J
Frank -
How do I debug an http service over a LAN in flex4
Hi I have a problem I would really like some help with.I am hoping to use PHP as a back end for my app. I don't think AMF looks viable as I can't change the php.ini file on the production server or install Zend. As my data requirements are very small I have opted for http service calls .My set up is all my files are on a development machine and I'm editing them through a lan connection on windows vista. I have php Zend server runing on the server with mysql set up.
My problem relates to testing. When I debug the file the calls don't seem to get through. The Network monitor confirms this. Also the spinning Icon stays up. I don't get any exception however.
If I then open up the swf file through the network share then the file works. If I copy it from the share to my hard drive it doesn't. I don't understand whats going on but it's making debugging difficult as I can't use traces this way and exceptions are ugly.
Is there a simple solution to this problem?
Things it can't be : firewall. I can definitely open this address on port 80. Also the network address is right and I assume that if I open the client on my machine then it is connecting from my machine, so when it works the address must be right.The only thing I can think is the cross domain policy but I don't see why that should occur when the files on the same machine or does flex create a local copy for testing?I'm pretty sure you can do this by making a manual menu.
>Insert a menu from your widget menu
>Select the menu options for your widget
>You will see an option that says "Menu Type" with choices of All Pages, Top Level Pages, or Manual
>Select "Manual"
You will have to manually set up your entire menu, but it will enable you to do what you are trying to do. Create the menu buttons that you need and name them. You can then select an individual menu button and the "Hyperlink" option appears in the top menus. You can either direct it to a page on your site or put in a link that directs them away from your site like you are looking to do.
Hope this helps! Nobody is responding to my request, so I figured I would try to respond to someone else while I was waiting! -
BlazeDS provides push functionality through HTTP ??
Hi All ,
In my application i am integrating my Flex app with Java Struts using BalzeDS. Now i have a requirement like Data(Server) push functionality through HTTP. I am using HTTPService calls only in my Flex application. Can BlazeDS provides push functionality through HTTP.If so , how can i use that??
I read a article about "BlazeDS Remote Object Service " and "BlazeDS Messaging Service" . I am so much confused. Please Help....
Thanks in Advance....Yes -- I had a similar experience. I found the order in which you enable this stuff is critical.
For me, I had to first enable the push server, configure it, stop it, go back into mail, set the server to push, start the notification service, then start and stop the mail service.
Push showed my test Leopard client as a connected user; no matter what I did with the iPhone though I couldn't get it to push (or connect.)
I ended up disabling the whole thing though, when I started seeing references in the system log to push service error messages. I'll need to dig back through them to paste them here on the forum, but it appeared something still isn't quite right.
The complete lack of technical documentation on this is a bit annoying, to say the lease. -
When I configure an http service, I create an operation updateItem, assign it a method of POST, Content-Type application/xml, and then specify a URL: http://localhost:3000/sites/1/students/3. Now when I go to test the operation, this is what I get:
InvocationTargetException:There was an error while invoking the operation. Check your operation inputs and try invoking the operation again.
Response Received:
Length Required
WEBrick::HTTPStatus::LengthRequired
Yet, in my application there is no such error when doing an update. However, when I try to accomplish it using Flash Builder, I get the above error. Am I doing something wrong in the Configure HTTP Service window? Thanks for any suggestions.I completely abandoned the CallResponder route. It just took too much time to figure out and there's practically no in-depth resources out there for setting it up with HTTP Service (although you will find resources for ColdFusion and PHP). So I tried HTTP Service rather than CallResponder in the code:
<mx:HTTPService id="user_requestsUpdate" url="{CONTEXT_URL}/user_requests/{user_requestsGrid.selectedItem.id}/confirm_request"
method="POST"
resultFormat = "e4x"
contentType="application/xml"
headers="{{X_HTTP_METHOD_OVERRIDE: 'PUT'}}" />
This produces this:
[RPC Fault faultString="Error #1090: XML parser failure: element is malformed." faultCode="Client.CouldNotDecode" faultDetail="null"]
It's shocking to me how difficult it is just to make a simple update using flex. -
Hi there, I have implemented an HTTP service to PHP. It sometimes gives an error like :
In the fault handler, I expanded the event detailes in debug perspective. I see that the requested xml is inside the event object. but the event is a fault event. Why flash builder gives that error sometimes? can anyone help?hi......abaki
Thanks for reply....
k.....first store that XML file in src dir. of Flex Project n call HTTP service n try to get result....if u can do it means in your flex appl. HTTP service call is right.... now in PHP prog.. just make HTML file with request n send it... now see its working ? then try on both Flex Proj n PHP....
i think this will help u..... -
How to send data to bam data object through java code
how to send data to bam data object through java code
I've made a suggestion in other thread: https://forums.oracle.com/thread/2560276
You can invoke BAM Webservices (Using Oracle BAM Web Services) or use JMS integration using Enterprise Message Sources (http://docs.oracle.com/cd/E17904_01/integration.1111/e10224/bam_ent_msg_sources.htm)
Regards
Luis Fernando Heckler -
Calling Web Service from Flex (to PeopleSoft)
I'm new to Flex and web services. I've created a web service
in PeopleSoft and successfully imported the WSDL into Flex so that
it has contacted the PS server and returned data (using
mx:WebService and mx:Operation code I found examples of). However,
I have been unable to pass a parameter to the service from Flex
using that code. I then discovered and followed the sample code in
the Flex-generated package, but no matter what I do I cannot
successfully supply the "myValue" in the sample shown below. Here
is Flex's own text in my GetInfo.as file built by Flex:
* MXML sample code:
* First you need to map the package where the files were
generated to a namespace, usually on the <mx:Application>
tag, like this: xmlns:ws="com.draper.*"
* Define the service and within its tags set the request
wrapper for the desired operation
* <ws:GetInfo id="myService">
* <ws:FindID_request_var><ws:FindID_request
Find__CompIntfc__DL_TREE_IB_CI=myValue/>
* </ws:FindID_request_var>
* </ws:GetInfo>
* Then call the operation for which you have set the request
wrapper value above, like this:
* <mx:Button id="myButton" label="Call operation"
click="myService.FindID_send()" />
My code is:
<ws:GetInfo id="userRequest">
<ws:findID_request_var><ws:FindID_request
Find__CompIntfc__DL_TREE_IB_CI="X"/>
</ws:findID_request_var>
</ws:GetInfo>
When I try to run it, Flex is unhappy with the value I am
assigning ("X" above) no matter what I put there. If I omit the
double quotes and try to assign a text input field value (which is
my goal here), it complains that it expects a double quote. If I
put almost anything else there, it complains either:
Initializer for 'Find__CompIntfc__DL_TREE_IB_CI'; values of
type com.draper.Find__CompIntfc__DL_TREE_IB_CITypeShape cannot be
represented as text.
or, if I try this line, where I attempt to pass a text input
field:
<ws:FindID_request
Find__CompIntfc__DL_TREE_IB_CI="{compID.text}"/>
then I get:
1067: Implicit coercion of a value of type String to an
unrelated type com.draper:Find__CompIntfc__DL_TREE_IB_CITypeShape
Can anyone help with this please?
Thanks
JimChris,
Thanks. That is what I *was* doing, that got me all data
returned. The parameter never gets passed in the XML. It acts as if
a blank was passed and returns everything (just as you would expect
in the PeopleSoft search page when you just click Find without
specifying a key). It is expecting a partial key and will return
all keys that match (find method).
PS expects the key DL_CS_COMPID, and in Flex I've seen
Find__CompIntfc__DL_TREE_IB_CI also. So I've tried:
<mx:request>
<!-- <DL_CS_COMPID> -->
<Find__CompIntfc__DL_TREE_IB_CI>
{compID.text}
</Find__CompIntfc__DL_TREE_IB_CI>
<!-- </DL_CS_COMPID> -->
</mx:request>
(You can see I currently have dl_cs_compid commented out).
Both behave identically - they are ignored in the XML that is sent
from Flex. Here is a sample of what was received in PS:
<?xml version="1.0"?>
<M540564.V1:Find__CompIntfc__DL_TREE_IB_CI
xmlns:M540564.V1="
http://xmlns.oracle.com/Enterprise/Tools/schemas/M540564.V1"
xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"/>
I believe there should be a
<DL_CS_COMPID>value</DL_CS_COMPID> string in there.
Maybe you are looking for
-
My iPad Air will not recognize my newest Apple ID e-mail address for cloud access. It continually reverts back to an old e-mail address that I no longer have access to and don't remember the PW for. How can I fix this?
-
Does anyone know of some good software that acts like a card-index - somewhere I can store information about books that I read/reviews/quotations? I've tried 'Googling' card-index software for mac, and various other permutations, but not come up with
-
How do i get proof of purchase from Apple? I recently moved and can't find my original receipts. I need proof for insurance company. My car was sent to total loss. I will be lucky to get $200. but still need the proof.
-
I am travelling in Amsterdam from Australia without my SIM card. Daughter enetred PIN incorrectly and now phone is locked. How can I get it rebooted and working again?
-
No iphoto pics can be selected for desktop
I just completed a software update and when it restarted, my desktop picture was replaced with the Apple purple starburst one. Argh. So I go to System Prefs, Desktop/Screen Saver and when I select any of my iPhoto pics it will not set the desktop and