Frameset in HTTPService result?!

Flex appears to be wrapping my XML in a frameset when I
invoke my HTTPService's "send()" method, and this is screwing up
the parsing of the response. (I'm getting the dreaded "Error 1090:
XML Parser Error..." runtime error.) It's not being done by my
server, because if I just surf that URL in a browser, I get what I
expect: pure XML.
Anyone know what's going on?
Thanks,
-db

This turned out to be a cross-domain security issue. I was
using an alias in my "url" property. When I used the real domain
name, it started working.

Similar Messages

  • How to set XML.ignoreWhitespace = false; in HttpService /Result?

    Please ask these kind of questions on flexcoders or the Adobe Flex Forums.  This is for development of the SDK itself.<br /><br />Matt<br /><br /><br />On 11/17/08 12:56 AM, "venubwal" <[email protected]> wrote:<br /><br />A new discussion was started by venubwal in<br /><br />Developers --<br />  How to set XML.ignoreWhitespace = false;  in HttpService /Result?<br /><br />I want to carry/preserve Leading & trailing spaces<white spaces> in event's result....<br />I am using service as :<br />_webService = new HTTPService();<br />_webService.url = serviceUrl;<br />_webService.method = "POST";<br />_webService.resultFormat = "e4x";<br />......<br />...Again i am checking it as -in<br />private function serviceResultHandler(event:ResultEvent):void<br />        {<br />        stopExecution();<br />        var doc:XMLDocument = new XMLDocument();<br /> doc.ignoreWhite = false;<br />        XML.ignoreWhitespace = false;<br />doc.parseXML(event.result as XML);<br />       Alert.show(event.result.toString(),"....serviceResultHandler...");<br /><br />But, i am not able see L&T spacesin alert() where I can see L&T spaces in Servlet/Java side which assigned as metaResponse<br />as....<br />      OutputStream writer = response.getOutputStream();<br />      OutputStreamWriter outputStreamWriter = new OutputStreamWriter(writer,"UTF-8");<br />JaxbSerializationUtil.serializeObjectToWriter(outputStreamWriter, metaResponse);<br /><br />________________________________<br />View/reply at How to set XML.ignoreWhitespace = false;  in HttpService /Result? <a href=http://www.adobeforums.com/webx?13@@.59b70bd4><br />Replies by email are OK.<br />Use the unsubscribe <a href=http://www.adobeforums.com/webx?280@@.59b70bd4!folder=.3c060fa3>  form to cancel your email subscription.

    By Using XML.ignoreWhitespace = false; <br />I am able to Store/Carry/Save L&T white spaces in XML and i can retrive values with whitespaces...<br /><br />It is in case of loading from Java<DB> to Flex.<br /><br />But the actual problem is with xmlObject.toString()/toXMLString()<br />is not able to carry whitespace, while it should carry as parameter to Java Servlet..so that it can be get using request.getParameter() [..then it is serializing/deserializing]<br /><br />So, how i can preserve the L&T whiteSpaces on XML.toString()/toXMLString() method.<br /><br />OR else<br />How we can set Http request attribute in Flex, so that we can use ( AnY_Object)request.getAttribute()...

  • Httpservice result strange

    When my HTTPService result comes back the 'event.result'
    variable always has an '\r\n\r\n' sequence at the beginning.
    How do I get rid of this ?
    I am simply feeding the httpService with an echo from a php
    script eg. echo "messageHere";
    Thanks for any advice.

    \r\n means, "carriage return followed by a new line". You've
    probably got some extra line breaks in your PHP script. You can get
    rid of them in flex using StringUtil.trim(event.result), but if you
    have whitespace characters you care about at the beginning or end
    of your event.result, you will lose them.

  • Can't set public Object in HTTPService result listener

    Hello.
    I am using a data object class.  The class is based on a class that contains the HTTPService calls.  I want to return the event.results to the local instance of the class by setting a public Object = the results Object. However, the public object is null after the HTTPService event result listener function is finished.
    It is easier to see than to describe:
    In the main application. i make an instace of my activity class:
    myactivity:activity = new activity() ;
    now, I invoke the getdata method:
    myactivity.getdata() ;
    The getdata() method fails at runtime, because it tries to reference the results object.
    See the base class and the activity class below.
    BASECLASS: (just the main parts are listed here):
    public class transferObject
            public var baseurl:String ;
            public var dbresult:Object =new Object();
            public var service:HTTPService ;
            public function transferObject()
            geturl("ghost") ;
            public function geturl(db:String) : void
                    baseurl = "https://xyzzy/" ;
            public function getHttpService(methodname:String):void {
                    service = new HTTPService();
                    service.url = this.baseurl + methodname;
                    service.channelSet ;
                    service.method = "POST";
                    service.addEventListener("result", httpResult );
                    service.addEventListener("fault", httpFault);
                    service.send();
               public function httpResult(event:ResultEvent):void {
                    dbresult = event.result ;
    //DBRESULT IS THE OBJECT I WANT TO REFERENCE IN THE DERIVED CLASS
                 //Do something with the result.
                public function httpFault(event:FaultEvent):void {
                    var faultstring:String = event.fault.faultString;
                    Alert.show('Error sending data: '+faultstring+' '+event.fault);
    HERE IS THE DERIVED CLASS:
    package dataObjects
        public class activity extends transferObject
        import mx.controls.Alert ;   
    [Bindable]
    public var event_id:String ;
    [Bindable]
    public var description:String ;
           public function activity()
                super();
            public function getdata():void
                getHttpService("eventually.sendtest") ;
              this.event_id = dbresult.result.activities.activity.getItemAt(0).event_id ;
    ----> THE LINE ABOVE FAILS AT RUN TIME BECAUSE THE DBRESULT OBJECT IS NULL
    THANK YOU FOR ANYHELP YOU CAN PROVIDE

    Sorry, but parameters of a ServeletRequest can not be modified. Look at the javadocs on ServeletRequest and you will see that "getParameterMap" returns an immutable Map. JSF is simply wrapping that method call with their own "getRequestMap" method. Setting an attribute, request.setAttribute(name, object), is how you pass things using the request to servlets, jsps, etc. on down the line. Just get the attribute instead of the parameter where you need it. Set your "parameter" in the attributes, down the line, check the attribute first, if it exists, use it, otherwise look for the parameter.

  • Using HTTPService results for WebService

    Here's the deal.  I am using an HTTP request to get the Session Variables that I need to use in a Web Service.  How do I time it so that the resutls from the HTTP request are used in the Web Service request?  Do/Can I bind them?  Do I need to set a trigger to wait for the HTTPService to return and then run the Web Service?
    Thanks in advance.

    Note: The only solution I've found so far is to put the web service call in the results function after the HTTPRequest returns with a positive result.

  • Assigning httpservice result in an array

    Hi all,
    I have been trying to call a httpservice and trying to assign
    the result in an array as shown below
    quote:
    Code:
    var grade:Array=userRequestReload.lastResult.servicelo
    cations as Array;
    // this is not working
    For the corresponding code the httpservice tag used is:
    quote:
    Code:
    <mx:HTTPService id="userRequestReload" useProxy="false"
    method="POST" fault="defaultFault(event)"
    result="reloadComboData()" />
    I an not able to get the desired outcome. I tried setting the
    resultFormat to array also but couldnt succeed.
    Hope to get help soon.
    Thanks

    That question is generalizable to all of the resultFormats
    that take XML and convert it to something, like the default
    "object'. That conversion is a gray box, and you have little or no
    control over it. Reading the doc on the "array" format is not
    enlightening.
    If you are getting xml from a data source, I advise using
    e4x, so that you can control what the heck happens to your data.
    Tracy

  • HTTPService results cached in IE

    Hi,
    I am embedding flex in a web application. I am using
    HttpService to send request and get data to be displayed. I don't
    want flex to cache my results as when I send the same request
    again, it returns data from the cache and not the new set which
    might have changed.
    Thanks!

    If you use "POST" instead of "GET", the result should not get
    cached. Try that first.
    If that does not work for you, append a unique string to the
    HTTPService url before invoking send. The will always prevent
    caching

  • (HTTPService - result="" - to ArrayCollection) -  a question for super expert ;)

    Firstly look at my example then you will read the question:
    Look at example below - I'm using HTTPService component to retrieve data from SQL database
    (read_record.php is generating nice and tidy xml file with my data)
    <!-- (A) read  -->
    <!-- =================== HTTP SERVICE (read_record) ============================ -->
        <mx:HTTPService id="readTimed"
            url="http://www.pudelek.pl/SCRIPT/A/read_record.php"
            result="patient(event)">
        </mx:HTTPService>
    Then 'result' is calling a function patient() which task is to assign 'event.result'
    to ArrayCollection called 'A_patient_dp'  (this ArrayCollection is a data provider
    for a specific data grid)
    private function patient(event:ResultEvent):void {
        trace("A - PATIENT - loaded...")
        trace(event.result.patient.patient)
        A_patient_dp = event.result.patient.patient
    Everything looks great here, data grid shows all the data from xml file generated
    by read_record.php
    and now is my problem :
    I don't want to display all the data, I want HTTPService to retrieve only particular data
    which are described by variable {parametr} - this var is generated by my application
    I've dond it this way:
    <!-- (A) MAP POSITIONING -->
    <!-- =================== HTTP SERVICE (read_record) ============================ -->
        <mx:HTTPService id="readRequestA"
            url="http://www.pudelek.pl/SCRIPT/A/A_send_read_record.php"
                useProxy="false"
                method="POST">
            <mx:request xmlns="">
                <idstaff>{parametr}</idstaff>
            </mx:request>
        </mx:HTTPService>
    I'm looking into source of 'A_send_read_record.php' in the internet browser and I see
    exact data tree (filtered) which I need.
    The problem here is : how to call function patient(event:ResultEvent) and give it
    data from the event to be assigned to ArrayCollection - like in first example.
    Thanks for all the ideas !!

    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services
    <mx:HTTPService id="readRequestA"
    url="http://www.pudelek.pl/SCRIPT/A/A_send_read_record.php"
    useProxy="false" result="patient(event)" method="POST">
      <mx:request xmlns="">
        <idstaff>{parametr}</idstaff>
      </mx:request>
    </mx:HTTPService>

  • Bind HTTPService result

    Hi,
    I am using HTTPService(say id="sampleHTTP") for loading xml.
    My xml looks like this.
    <node>
    <wsdl_endpoint>
    http://localhost/sample.asmx?WSDL</wsdl_endpoint>
    </node>
    In the result event I am giving an alert for the data from
    the xml(sampleHTTP.lastResult.node.wsdl_endpoint), itz showing the
    correct path. When I tried to bind this path for a Web Service,
    <mx:WebService
    wsdl="{sampleHTTP.lastResult.node.wsdl_endpoint}"........./>
    the result for web service is not triggered.
    Please help....

    Since you are binding to a WebService, I believe you need to
    make a call to the loadWSDL() method in order to download the Web
    Service data. One thing you could do is to put this call in the
    result event function for your HTTPService. That way as soon as the
    xml is loaded with the path, it will call your WebService to get
    the document.
    Vygo

  • HTTPService.result?

    I've got a HTTPService object.  In mxml I can write it like:
             <mx:HTTPService id="gateway" url="someURL" method="POST" resultFormat="e4x" result="gatewayHandler(event)" />
    If I try to create this in ActionScript, how do I add the result attibute?  The other ones are easy:
         var gateway:HTTPService = new HTTPService();
         gateway.url = "someURL";
    etc., but:
         gateway.result = gatewayHandler(event);
    gives an error message.  How do I add this handler in ActionScript?

    try
         var gateway:HTTPService = new HTTPService();
         gateway.url = "someURL";
    gateway.addEventListener(ResultEvent.RESULT, gatewayHandler);
      gateway.addEventListener(FaultEvent.FAULT, faultHandler);

  • How to get result of HTTPService within a function?

    Hello all,
    I'm trying to call an HTTPService's send() and get the
    resulting data from within a function, and assigning it locally.
    Specifically, this is what I want:
    private function getData():void {
    myRPC.send();
    //How do I set the result of myRPC.send to a variable here?
    // Neither myRPC.send().result, nor myRPC.lastResult works! I
    get null both times!
    // But if I set myRPC.result to a separate function that
    handles an event, I get the correct data...but not what I want.
    var myObject:Object = ???? myRPC.???
    <mx:HTTPService result="???" fault="???" id="myRPC"
    method="GET" resultFormat="e4x" url="someurl" useProxy="false">
    <mx:request xmlns="">
    <somedata>hi</somedata>
    </mx:request>
    </mx:HTTPService>
    I am also not sure what to put in 'result' and 'fault' since
    I don't want the result/fault to be passed to another
    function...could anyone explain this please? Thanks!

    "Hamshmam" <[email protected]> wrote in
    message
    news:g70olu$jcd$[email protected]..
    > Hi Greg,
    >
    > While this is not what I am looking for, thanks for your
    response.
    >
    > I am familiar with traditional HTTPService requests and
    passing the
    > resulting
    > event to a function handle directly and then modifying
    the object from
    > there.
    > However, as I described in my earlier post, I'm looking
    for a way to get
    > the
    > resulting event of the HTTPService.send() within a
    different function.
    >
    > I am doing this because if I have another function
    dependent on the
    > HTTPService.send()'s data, I cannot simply call the
    HTTPService.send()
    > from
    > within that function and update a class private var with
    the data, which I
    > access from the wrapping function. This is because the
    HTTPService is by
    > nature
    > asynchronous, so it is possible that the class private
    var will remain
    > null
    > while further lines of code are executed, all the while
    the HTTPService is
    > interacting with the server concurrently.
    >
    > I hope it is clear now why I need to assign the result
    of a HTTPService
    > result
    > directly within a function, if you or anyone else could
    shed some light on
    > that, I would appreciate it! Thanks for your response.
    http://www.johnwilger.com/2007/03/future-value-pattern-in-actionscript-3.html

  • Comparison of number of bytes transferred over network while using HTTPService and RemoteObjects

    If I have to transfer data(say records of 100 employees in a DB) from Server to Client, I could use HTTPService and fetch the data as an XML file and then convert it to ArrayCollection in the Client. Or use RemoteObject and transfer the data in binary. Lets ignore other methods(Web Services etc) of data transfer for the moment.
    Now, for the same data, if I implement the application using HTTPService and RemoteObject, I notice that the number of bytes transferred over the network is less in case of HTTPService(XML) when compared to RemoteObject(AMF) which is a shock to me. My understanding is that AMF transfer should be more compact than XML. Ofcourse, once the data is available, RemoteObject result processing is noticeably faster than HTTPService result processing. My concern is why data transferred using AMF is larger than XML. As an example, you may refer to the samples provided in TourDeFlex. Refer to the following:
    HTTPService:
        Found in : Flex Data Access->HTTPService->BasicExample
        Link: http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=0;sampleId =12700
        Click on the 'Get Data' button to fetch the data.
        Bytes transferred - 1050
    RemoteObject:
        Found in : Flex Data Access->RemoteObject->BasicJavaRemoting
        Link: http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=0;sampleId =13300
        Click on the 'Get Data' button to fetch the data.
        Bytes transferred - 1440
    This is a significant size difference. You may see the data transfer size by using developer tools like the HTTPFox Firefox extension.
    Am I missing something here? Any help will be very much appreciated.
    Thanks,
    Balu

    There is definitely problem with your tool or you looked at something else. Please check the attached snapshots of the session using charles capture tool. The response sizes are way bigger than what you mentioned but remoteobjects is almost half of httpservice for the complete transfer including request and response. Check below -
    httpservice -
    http://tinypic.com/view.php?pic=2q2le2e&s=7
    amf -
    http://tinypic.com/r/10wmx4o/7

  • Error when reading data in to ArrayCollection using HTTPService

    Hi,
    I am trying to read data in to ArrayCollection using HTTPService result property:
    [Bindable] private var myData:ArrayCollection=new ArrayCollection();
       private function result_handler(e:ResultEvent):void
            myData = e.result.root.contact;
      <mx:HTTPService id="post_submit"
           url="test.php"
           method="POST"
           result="result_handler(event)"
           fault="fault_handler(event)">
           <mx:request xmlns="">
           </mx:request>
       </mx:HTTPService>
    I am getting the following error when there is no "contact" record in the xml root:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    Also I am getting the following error when there is only ONE  "contact" record in the xml root:
    TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy@280c9ca1 to mx.collections.ArrayCollection.
    And it works fine when there is two or more "contact" records in the xml root.
    Am I missing something?
    Thanks

    I am getting the following error when there is no "contact" record in the xml root:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
         You'll be getting this error because it's trying to access nodes that don't exist;
         there are no 'contact' records, thus when it tries to access node 'root.contact', it doesn't exist, hence it's receiving NULL when it's expecting      something
    Also I am getting the following error when there is only ONE  "contact" record in the xml root:TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy@280c9ca1 to mx.collections.ArrayCollection.
    And it works fine when there is two or more "contact" records in the xml root.
    Am I missing something?
    Thanks
          When there is only 1 value, it'll be returned as an object (Arrays are used for multiple items). So it throws an error as it isn't expecting a single           object, it wants an Array.
         This is also why when it returns 2+ records, there is no error. Multiple results will be returned as an Array, what your flex app was expecting.
         My initial guess to solve the first problem would be similar to Greg's, although i'm guessing you'd want;
        if(e.result != null){
         instead of
         if(e.result.root.contact != null){
        as you'd initially want to check if anything was returned in the result, rather than checking to see if a certain node exists.
         If you attempt to see if a certain node isn't null, and the node doesn't exist, it'll probably throw another #1009
         For the #1034 error, you'll have to check to see how many results were returned, as Madhav has described for you.

  • Add event listener to HTTPService call

    Hi – I am using a HTTP service within my flex
    application.
    My HTTPServeice is connecting to an XML file:
    <mx:HTTPService
    id="myResults"
    url="
    http://localhost/myResults.xml"
    resultFormat="e4x"
    result="resultHandler(event)" />
    the data within the XML file is constantly changing (the
    structure remains the same, but the actual data within the
    structure of the XML changes), therefore I am refreshing my
    HTTPService results every 5 seconds:
    [Bindable]
    public var myDataFeed:XML;
    private function initApp():void
    var timedProcess:uint = setInterval(refreshResults, 5000);
    private function refreshResults():void
    myResults.send();
    private function resultHandler(event:ResultEvent):void
    myDataFeed = event.result as XML;
    My problem is that sometimes the XML file needs longer than 5
    seconds to load / refresh the data (as it is quite heavy)
    etc… therefore I want to implement some sort of event
    listener on the HTTPService to let the application know when the
    results have been refreshed so I can restrict / the 5 second
    refresh taking place until the previos refresh is complete
    etc…
    is this possible – to set an event listener to a
    HTTPService to know when it has completed refreshing results from
    an XML file???
    Thanks,
    Jon.

    result="resultHandler(event)" <--- is already an event
    listener.
    btw if you have a live XML you might want to consider xml
    socket connection so that server will push data to client .(lot
    more efficient)

  • Handling HttpService and Remoting Service simultaneously

              I have a RemoteObject(service) to communicate to the back end and retrieve the data. I used HttpService to create a form dynamically and I have datagrid on the form. Once, I clicked the get button in the form, the data should be retrieved from the database and shown in the datagrid.
    As expected, I clicked the get button, it will dispatch the CairngormEvent(which will internally call the remoteObject and get the data) and which will get populated into the datagrid, but these both operations are happenning simulatneously.So, that I could not get the values in datagrid. If I click again, it is populating the values. I would like to prevent running simulatneous operation of these two, Only after the remoteObject is done with get all the values from backend, it should continue further.
    Could you please help me to resolve this issue?

    The key in this case is to change things to the remote service gets called in the HTTPService result handler after that result handler is done with whatever it needs to do, or perhaps a method is called inside the HTTPService result handler calling the remote service.
    Another option, and perhaps the more logical one, is to call the remote service in the form creationComplete event handler, if the problem is that the form is not being created by the HTTPService yet.
    Events like this in Flex are asynchronous, so it is necessary to structure things this way.
    If this post answers your question or helps, please mark it as such.

Maybe you are looking for