I am trying to connect to a Perl script on my server.
At the moment I'm mostly flopping around.
Below are snippets of the code involved.

I was hoping for hints on what bit of blatant stupidity I've overlooked.
Or, perhaps a few best practices on how to debug returning information
such as this.
Or, perhaps pointers to a method for "looking" at the returned object
to see what it is. 
Or, maybe everything is fine and it's a problem with how to properly
access the data in the xml.

Regards

===============================================
I use the following for the HTTPService
<mx:HTTPService id="srv" url="http://www.mydom.com/cgi-bin/script.pl";
        useProxy="false"
        resultFormat="e4x"
        result="httppostResult(event);"
        method="POST">
        <mx:request>
                <resource>{resourceParam}</resource>
                <resource2>{resourceParam2}</resource2>
                <resource3>{resourceParam3}</resource3>
                <resource4>{resourceParam4}</resource4>
        </mx:request>         
    </mx:HTTPService>

<mx:Script>
<![CDATA[
    [Bindable]
    private var resourceParam:String = "uniits";
    [Bindable]
    private var resourceParam2:String = "uniits2";
    [Bindable]
    private var resourceParam3:String = "uniits3";
    [Bindable]
    private var resourceParam4:String = "uniits4";

    private var flexitXML:XML;
            
    private function httppostResult(event:ResultEvent):void              {
                flexitXML = event.result as XML;
// or           flexitXML = new XML(event.result.toString());
                resultsTextArea.text = flexitXML.toString();
                resultsLabel.text = flexitXML.a.b.resource;
            }
     }
]]>
</mx:Script>

================================
script.pl returns
Content-type: text/xml

<?xml version="1.0" encoding="utf-8"?>
<a>
  <b>
    <resource2>uniits2</resource2>
    <resource3>uniits3</resource3>
    <resource>uniits</resource>
    <resource4>uniits4</resource4>
  </b>
</a>

================================
resultsTextArea.text =
<a>
  <b>
    <resource2>uniits2</resource2>
    <resource3>uniits3</resource3>
    <resource>uniits</resource>
    <resource4>uniits4</resource4>
  </b>
</a>

Reply via email to