0 Replies Latest reply on Apr 3, 2012 11:53 PM by megadata102006

    Sending xml data through http services in adobe air

    megadata102006

      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 request