HTTPService - GET and POST in Flex

I'm sending JSON data to a PHP script on the server, and I'm a bit new to the server side stuff so I'm hoping you all can answer a few questions.
1) I thought using POST was more secure than GET, as GET sends parameters with the URL, but when I send by post, spaces are replaced with %20, so is my data really being sent by POST, or GET?
2) I thought I had heard that under certain conditions you might send data by POST, but due to a bug Flex actually sends the data by GET. What are the conditions under which this happens?
3) How can I send usernames and passwords using HTTPS in Flex using HTTPService. I assume I should use HTTPS as it is supposed to be secure.
4) I've been messing around with PHP to process the data on the server, but quite frankly, working with PHP seems really difficult. I get the data, a PHP print says its an object, but object notataion ->  => does not seem to work. I've used PHP methods to get the object "keys", and also done a little with processing PHP arrays, but it still seems like PHP does not make it easy on you. Anything better for more easily transferring data securely between Flex and MySQL?
Thanks very much in advance!
Greg

Hi Greg,
What build of Flex are you using?
1) When using HTTPS the GET URL would also be encrypted, but once decrypted on the server the URL might be logged so it's suggested to not use GET for transmitting credentials.
In 3.x, the default contentType is application/x-www-form-urlencoded - but what happens to your data depends on the type of the params passed into HTTPService.send(). Are you constructing a JSON request as a String?
BTW, did you try to set a contentType? I looked at the 3.x SDK source in SVN and the HTTPService contentType property still has metadata which provides code insight in the IDE but it also restricts the values of . When toString() is called on this XML node the root node is unwrapped and the empty string content returned. To avoid this toXMLString() can be called on the XML node to get the entire XML representation.
3) Load your SWF via HTTPS and use also HTTPS to send your credentials to the server and establish a session. If you tried to use a Basic Auth challenge you'd have to rely on the browser authentication dialog as you can no longer preauthenticate using an "Authorization" header as it is on the list of headers not allowed by flash.net.URLLoader. See the docs for URLRequestHeader used to configure headers with URLLoader:
http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequestHeader.html
As for how to send custom credentials... I think if you can solve your issue in 1) then the rest is up to what you want to do on the server. There should be lots of PHP login examples out there too. As a best practice try to delete / null out credentials variables when they're no longer in use on the client or server. Even though you're using HTTPS, consider additionally Base-64 encoding the credentials (for example, you could copy the format of the HTTPS Authorization header with a single "username:password" string) to obscure them in the event that a clear text version of the request is logged, or viewed in a debugger, etc.
Pete

Similar Messages

  • Hot to Make HTTPS GET and POST calls from ExtendScript

    We are currently porting our ActionScript code to ExtendScript (JavaScript).
    We performed HTTPS GET and POST calls from ActionScript with no problem. I can find no way to make HTTPS calls from ExtendScript. We tried jQuery, but after hours of work we can't get the ExtendScript engine to work with it - even a very, very old version of jQuery.
    What do I do?
    TIA,
    mlavie

    Adobe needs a "Want Answers" button like Quora has because I would press that button on this post.

  • How to Create simple WCF/REST (JOSN,get and post) and deploy to Sharepoint 2013 Server.

    HI All,
       I wan to create a simple WCF/REST service and deployed to SharePoint server , i have created some sample svc file and put in to _vti_bin folder using SharePoint solution using vs 2013 but its not accessible from IIS its always asking the Widows
    Authentcation .
    however my exact requirement is custom service should be accessible without asking the authentication like _vti_bin/Listdata.svc is there any way to do like this ? 
    my reference:
    http://platinumdogs.me/2013/03/14/sharepoint-adventures-with-the-rest-api-part-1/
    http://msdn.microsoft.com/en-us/library/office/jj860569(v=office.15).aspx
    http://dotnetmentors.com/wcf/wcf-rest-service-to-get-or-post-json-data-and-retrieve-json-data-with-datacontract.aspx
    http://stevenhollidge.blogspot.in/2011/09/wcfwebapi-rest-json-services.html
    Thanks
    SujilKumar
    Software developer

    Hi Sujil
    Greetings. pls check this link
    http://social.technet.microsoft.com/wiki/contents/articles/24194.sharepoint-2013-create-a-custom-wcf-rest-service-hosted-in-sharepoint-and-deployed-in-a-wsp.aspx
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Session is being lost between GET and POST

    My application is being developed in Tomcat 4.1.18.
    I have a servlet that acts as a Controller and JSP's that make up the View. Basically, the session gets lost in the following manner:
    The application's web.xml file is set with Authentication method of Unspecified. Basically, it's not a high security application, we just need to make sure that the user maintains a session throughout the application.
    User is presented with a page (login.jsp). They present their credentials. The controller does an include (RequestDispatcher.include) on a jsp (this jsp simply does a setProperty *) to fill the bean. Then, the controller passes control (through RequestDispatcher.forward) to the Action servlet. The Action does some processing and forwards to the next destination. Next, the user clicks on a link (GET) (this causes the URL to be rewritten with the correct session ID). In this particular instance, the user is presented with a form to fill out. The user fills out the form and it POSTS to the controller. At this point, the controller attempts to access the session and it is lost!
    Frustrating. Please feel free to email at [email protected] Thanks.

    I just tried encoding the FORM ACTION and no dice. I'm pretty new to JSP's so I'm wondering if its something stupid that I'm doing (or not). I've never had this problem using straight servlets before.
    It would be hard for me to justify getting rid of the JSP's and going with a straight servlet solution.
    I'm also wondering if my Authentication:Unspecified in the web.xml file has anything to do with my current troubles.

  • Developing a code with multiple GET and POST requests

    hi all,
    i have a requirement to upload a video file to a server and i need your help to develop the code using java .Basically it has several steps like
    1) A GET request should be made to the server with parameters like file name,size etc
    2) The response from the server is an XML document which contains a list of URLs to upload the file to.
    3) Get the URL from the XML and POSTyour file to the URLs listed in response.
    4) After POSTing the video file to the url(s) you received in the Create Video request, a GET request should be made to this URL to signal that a video has finished uploading in its entirety and check for the response code to see if the file is uploaded
    5) If an upload cannot be completed signal that has uplaod has failed by by making another GET request to the server
    I am not sure how can i implement all these steps in one single java program. Can someone please advise
    Thank You

    ForumKid2 wrote:
    Although you could technically do it all in one Java class, it makes no sense.Agreed 100%. But the question was how to do it in one program, which of course could contain numerous classes. (Unless the OP is confused about what a program is...)

  • Which http method to use- get or post???

    hi all.........
    i m trying 2 proceed URLs using httpclient with GetMethod & PostMethod. But i m confuse about that at which time which method i hav 2 use- getor post??
    The whole implementation of my code is done using j2se.
    It's so important part of my project. So plz help me...

    Random question to ask in these forums, you can do a simple google seach to find the difference between Get and Post.
    Basically Get will parse information at the end of your address, such data will be made public to see.
    e.g. www.mel.com?name=mel
    Post on the other hand stores the data inside the body of the html document, upon more things.
    Mel

  • Is the CO using GET or POST

    Hi All,
    One OAF concept question I have is : How can we tell by seeing a CO code , whether it uses a GET or POST method of submitting.
    Thanks,
    Srikanth

    Hi Srikant.
    Assuming the PR is being called by GET , do you mean to say that the page form values will be passed as through URL.YES.
    Or a decision is taken at run time on the method based on the magnitude of form valuesMost probably NO. It will depend on browser whether it crashes or sends data or shows error message, IF the data is more than its CAPASITY.
    URL specification itself does not put any length restrictions, but length restriction are put by browser and server. For ex, IE may be having max url size to 2k(Please confirm by googling exact lenghth for individual browser). Similar restriction is put by server also.
    However in case of PUT, data is sent in header of packet, hence its size is usually much more larger,(Sufficient for near most of the cases)
    So as much I know. No matter what the size of data is, in case of GET, its PR which is called. In case of POST, Its PFR.
    More over.A form submit can be done by both GET AND POST. However OAF uses POST By default for form submission.
    So again, even if data is submitted by GET, Its PR.AND if data is submitted by POST, its PFR which will be executed.
    Decision of method (PF or PFR) is done by getting method type (GET OR POST).
    Method type(GET or POST) is retrieved from HTTP header. (I did not find it documented anywhere that OAF gets method information from HTTP header, but there does not seems any other way possible.)
    By the way Srikanth, why this doubt came to you that decision might be taken at runtime for large data submissions?
    Abdul Wahid.

  • Is it possible to get post or Get variables into a flex applicaition without messing with the flashvars?

    Is it possible to get post or Get variables into a flex
    applicaition without messing with the flashvars?

    Probably externalInterface, and maybe BrowserManager.
    But both of those are much harder and messier than flashvars.
    Why are you trying to avoid the easy way?

  • Created site in iweb 08 and posted to netfirms... the pages are all loaded up but there is no nav bar, it comes up on each page as a small black dot. How do I get the nav bar to load up and show?

    I created site in iweb 08 and posted to netfirms... the pages are all loaded up but there is no nav bar, where the nav bar should be is only a small black dot on each page. How do I get the nav bar to load up and show? It was a disaster loading up my site as it changed the case of the letters and at first no pages were seen, so I had to go through and change the letters that were supposed to be cap, back to cap in every file. I don't know if this has something to do with it or not. The tech support doesn't have an answer. Please let me know if you have any ideas and solutions. Thanks bunches!

    Here are links to the simple 7 pages....
    http://www.rednosedesign.net/home.html
    http://www.rednosedesign.net/about_us.html
    http://www.rednosedesign.net/logos.html
    http://www.rednosedesign.net/flyers_&_ads.html
    http://www.rednosedesign.net/notecards.html
    http://www.rednosedesign.net/business_cards.html
    http://www.rednosedesign.net/contact_us.html

  • Hi. I clicked some snaps from my iphone and post that without copying it i restored the iphone with all apps etc available from the backup taken. How do i get back the photos which were clicked earlier. Is there a way to get it back?? Please help

    Hi. I clicked some snaps from my iphone and post that without copying it i restored the iphone with all apps etc available from the backup taken. How do i get back the photos which were clicked earlier. Is there a way to get it back?? Please help

    Yes i had not taken back up before restoring it. However i was just going through some links on the net and there is a software available for MAC to retrieve such lost data. But the point is will the said software work on iphone as the OS is not MAC..
    Will have to give a try to this. If successful will share it with all. Anyone else has any idea about this please so share.

  • Http.get and http.post is now what under utl_http?

    In previous source code sample(s), the statement http.get(url,response,content_type,proxyServer,proxyPort) doesn't exist in 9i. The sys.utl_http has get_Response but that doesn't take the same arguments. What is the utl_http call that would replace the http.get and http.post of 8i?

    In short, POST requests are for sending any amount of data directly over the connection without changing the URL, and GET requests are for getting limited amounts of information appended to the URL.
    POST requests cannot be bookmarked or emailed and do not change the Uniform Resource Locators (URL) of the response. GET requests can be bookmarked and emailed and add information to the URL of the response.

  • Do get and do post?

    Hi all,
    before, I belive if I can use do get then I can change it to do post.
    now
    my parameter come from jsp
         <A HREF=/SKL/servlet/Formate?click=<%= link.getNewNum() %>>in my servlet I
    String select = request.getParameter ("click");
    do search on database .
    disp = getServletContext().getRequestDispatcher("/secure/Formate.jsp"); it only work on do get . if I try to change to do post , I got empty display .
    why??
    Thank you

    Did you set action="POST" in your <FORM> tag in the
    JSP?I think the OP meant requests generated by clicking on a hyper link.
    Have u over riddendoPost() method?????It wont work even then.
    it only work on do get . if I try to change to do post , I got empty display .
    why??That's bcos post requests could be submitted only through form submissions. When you submit a form, you have an option of specifying that the request method be get or post.
    When you access a resource by clicking on a url link, the request is always get. The max you could do is call doPost() from doGet() if you do want the code in doPost() to get called.
    Cheers,
    ram.

  • Mx:HTTPService tag and mx:headers tag question??

    I am trying to send some header information to my servlet via
    HTTPService.
    I have a <mx:HTTPService> tag and I see that I can have
    child tags to pass header information in the request,
    <mx:headers> But I am not sure of the syntax, I get parse
    errors in the Flex Builder editor. Here is what I have:
    <mx:HTTPService id="Test" method="POST" resultFormat="e4x"
    contentType="application/xml" url="myServlet" useProxy="false">
    <mx:headers>
    <!-- NOT SURE OF THE SYNTAX FOR THE DATA I WANT TO SEND
    HERE????? ->
    </mx:headers>
    </mx:HTTPService>
    Does someone have an example of the <mx:headers>
    section??? I want to pass a value or 2 to my servlet.
    Thanks!

    You can try building the request object in AS instead of
    declaratively
    private var getData():void {
    var oRequest:Object = {};
    oRequest["ui.action"] = ""run";
    oRequest["ui.object"] = "whatever";
    http_srv.send(oRequest)'
    Tracy

  • Getting at POST data from a pl/sql procedure through Path Aliasing

    Hi.
    I have mod_plsql configured with "path alias" and "path alias procedure" so that the request ends up in my
    procedure and i have the remaining path in p_path. This is what I want.
    http://<domain>/<dad>/<myalias>/<p_path>
    My question is; is there a way at this point to get at POST data in the request? I haven't been able to find
    any way of doing this looking through the documentation. Is the body of the request lost at the gateway
    (mod_plsql) using path alias?
    If so, is there some other way to achieve something like !myproc(name_array [somearr], value_arr [somearr])
    where the first entry in the arrays is an eqvivalent to p_path?

    Billy  Verreynne  wrote:
    Øyle wrote:
    I have mod_plsql configured with "path alias" and "path alias procedure" so that the request ends up in my
    procedure and i have the remaining path in p_path. This is what I want.
    http://<domain>/<dad>/<myalias>/<p_path>
    My question is; is there a way at this point to get at POST data in the request? Do not understand the question as a POST and GET are simply two different methods that a web browser submits a URL and data. There is no "+path+" involved here.Thank you for answering. I think the confusion is because you disregard what I said about "path alias" and "path alias procedure".
    Those are configuration of the mod_plsql gateway so that any URI containing <myalias> above is directed to the procedure stated
    by "path alias procedure". The gateway also sends any remaining parts of the URI to this procedure as an varchar2 argument (p_path).
    My problem is that I see no way to get at any POST data as the signature of this procedure has to be this one varchar2, and I don't
    know any other way to get at the body of the request.
    >
    If so, is there some other way to achieve something like !myproc(name_array [somearr], value_arr [somearr])
    where the first entry in the arrays is an eqvivalent to p_path?If you want to know what the URL is, the full path used, then you need to look at the CGI (Command Gateway Interface) environment. The web server builds a list of CGI variables. These include the type of web server, the URL, the type of HTTP command (GET or POST), and so on.
    Within your PL/SQL web procedure, you can query these CGI variables. Have a look at the function OWA_UTIL.GET_CGI_ENV in the [Oracle® Database PL/SQL Packages and Types Reference|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/w_util.htm#i997269] guide.
    Take a look at CGI variables such as PATH_INFO, PATH_TRANSLATED, SCRIPT_NAME and so on.Yes, thank you, but my problem is a bit upside down. I do use the cgi environment to get the method and I have path as input, what I can't
    find is the body of the request. I might be approaching this entirely the wrong way. It might be a bit easyer to understand if I state that I'm
    trying to find a way to implement a RESTfull service in pl/sql.

  • Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination

    Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination
    Problem in committing transactions in Multiple Forms (Oracle Forms) with POST built-in command:
    Consider that the following statements are written in WHEN-WINDOW-CLOSED trigger of a called form.
    Statements in called form (Form name: FORM_CHILD):
    go_block('display_block') ;
    do_key('execute_query') ;
    -- Data from table_b will be populated in this block, based on the value of COLUMN_1 obtained
    -- from TABLE_A.
    -- Example: If the value of COLUMN_1 is 10, then all the matching records from TABLE_B, which
    -- are inserted with value 10 in TABLE_B.COLUMN_1 will be fetched and shown here.
    if user_choice = 'YES' then
    commit ;
    else
    rollback ;
    end if ;
    Statements in calling forms:
    There are two calling forms having following statements and it is going to call the above said called form.
    CALLING FORM 1
    Statements in KEY-COMMIT trigger:
    post;
    call_form(form_child, no_activate) ;
    Statements in ON-INSERT trigger:
    select column_1
    from table_a
    for update of column_1
    where column_2 = 'X' ;
    update table_a
    set column_1 = column_1 + 1
    where column_2 = 'X' ;
    insert into table_b ...;
    insert into table_b ...; Statements in KEY-COMMIT trigger:
    post;
    call_form(form_child, no_activate) ;
    CALLING FORM 2:
    Statements in ON-INSERT trigger:
    select column_1
    from table_a
    for update of column_1
    where column_2 = 'X' ;
    update table_a
    set column_1 = column_1 + 1
    where column_2 = 'X' ;
    insert into table_b ...;
    insert into table_b ...;
    insert into table_b ...;
    Our understanding:
    Assume that both the forms are running from two different machines/instances, issuing commit at the same time. In this case, forms will start executing the statements written in ON-INSERT trigger, the moment POST command is executed. Though the commit is issued at the same time, according to oracle, only one of the request will be taken for processing first. Assume that calling form 1 is getting processed first.
    So, it fetches the value available in COLUMN_1 of TABLE_A and locks the row from further select, update, etc. as SELECT...FOR UPDATE command is used (note that NOWAIT is not given, hence the lock will be released only when COMMIT or ROLLBACK happens) and proceed executing further INSERT statements. Because of the lock provided by the SELECT...FOR UPDATE command, the statements in calling form 2 will wait for the resource.
    After executing the INSERT statements, the FORM_CHILD is called. The rows inserted in to TABLE_A will be queried and shown. The database changes will be committed when user closes the window (as COMMIT is issued in its WHEN-WINDOW-CLOSED trigger). Then the SELECT...FOR UPDATE lock will be released and calling form 2's statements will be executed.
    Actual happenings or Mis-behavior:
    Calling form 2 starts executing INSERT statements instead of waiting for SELECT...FOR UPDATE lock. Also, the value selected from TABLE_A.COLUMN_1 is same in both the calling forms, which is wrong.
    The rows inserted into TABLE_B are having similar COLUMN_1 values in calling form 2 and they are fetched and shown in the called form FORM_CHILD.
    Note that in calling form 2 also POST only is issued, but the changes posted there are accessible in calling form 1 also, which is wrong.
    Kindly suggest us as to how to fix above problem. It will be much use, if you can send us the information regarding the behavior of Oracle Forms POST built-in also.
    Our mail ID: [email protected]
    Thanks a lot in advance.

    You have several problems:
    1. On-Insert will ONLY run if you have created a new record in a base-table block. If you haven't done that, then the POST command will not cause it to run.
    2. Select for update without a "no wait" will lock records for the first form, but when the second form tries this, it will hit the ORA-00054 exception, and will NOT wait. The only way you could make it wait is to issue an UPDATE sql command, which is not such a good way to go.
    All POST does is issues SQL insert or update commands for any changes the user has made to records in a form's base-table blocks, without following with a Commit command.
    Also understand that Commit is the same as Commit_Form, and Rollback is the same as Clear_Form. You should read up on these in the Forms help topics.

Maybe you are looking for

  • Connecting Itunes Music Library (ext. HD) in a new PC (new copy of Itunes)

    Hello : My music library is stored in an external hard-drive. I just bought a new laptop and installed Itunes. Now, I am having tremendous problems connecting this new copy of Itunes to the library that exists in my external hard drive. Would appreci

  • Applying "TRANSLATE" function on a large Text. String Operations on a CLOB

    Hi All, Here is the SQL query that I am using.... SELECT TRANSLATE([TEXT], '{}*:/=-', ' ') as TEXT2 FROM DUAL; Where [TEXT] value comes a different program. We wrote the above query thinking TEXT would be always less than 4000 characters. But it is e

  • Not able to change whre to save images in camera raw

    Several times after installing Yosemite and then buying into photoshop CC (because cs6 started acting erratic with Yosemite), when trying to change the location as to where the images are saved, Photoshop just replies "Error. The task cannot be compl

  • CHANGE CHECKBUTTON INPUT STYLE

    I'm a little disappointed in Adobe.  I use acrobat all the time, but I have very very little experience with scripting.  I've done some research, yet I still can't get the script right.  >Acrobat 7 lets me change the appearance of the checkbox - but

  • Service Short Text is not copied creating Req w.r.t Contract

    Hi, When I try to create a req service item with reference to a contract, short text (TXZ01) is not copied from contract to req. The field is open for input and I have to input manually, or I'll get error ME083. Is here a way to copy short text from