8 Replies Latest reply on Jul 5, 2007 11:14 AM by ntsiii

    XMLList Problem

      Hi Nitsii,
      I'm new to flex.Can anyone please guide me .
      I used webservices for accessing SAP Backend. i get the result as XML format.
      xmlresult=XML(event.result); & store the values of the particular field to xml List. If i choose the Qualification text from Combo control corresponding ID of the QualificationText field sholud be retrieved from Qualification table.how do i do that.??
        • 1. Re: XMLList Problem
          gjastrab Level 1
          Please give an example of the XML you're getting back and what part you're trying to pull out. This is too vague to answer so far.
          • 2. Re: XMLList Problem
            Thenmalar Level 1
            I have sent u my MXML file to u.
            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="1500" height="1600" x="6" y="103" creationComplete="doNewSearch()">

            import mx.rpc.AbstractService;

            import mx.rpc.soap.mxml.WebService;
            import mx.events.ItemClickEvent;
            import mx.rpc.events.ResultEvent;
            import mx.managers.CursorManager;
            import mx.controls.Alert;
            import mx.collections.*;
            import mx.utils.ArrayUtil;

            default xml namespace = " http://entegdt21.enteg.com";
            [Bindable]public var _xmlResult:XML; //holds the result xml
            [Bindable]public var _xmlResult2:XML;
            [Bindable]public var _xlDataSpecial:XMLList; //dataProvider for the day weather dataGrid
            [Bindable]public var _xlDataSpecialID:XMLList;
            [Bindable]public var _xlDataQualifID:XMLList;
            [Bindable]public var _xlDataQualif:XMLList;
            [Bindable]public var _xlDataSkill:XMLList;
            [Bindable]public var _xlDataSkillID:XMLList;
            [Bindable]public var _xlDataProfi:XMLList;
            [Bindable]public var _xlDataProfiID:XMLList;
            [Bindable]public var _xlDataAdv: XMLList;
            [Bindable]public var _xlDataAdvID:XMLList;
            [Bindable]public var _xlDataDesig :XMLList;
            [Bindable]public var _xlDataDesigID :XMLList;

            [Bindable]public var _xlDataPostn :XMLList;
            [Bindable]public var _xlDataPostnID :XMLList;
            [Bindable]public var _xlDataIndustry:XMLList;
            [Bindable]public var _xlDataIndustryID :XMLList;
            [Bindable]public var _sAppno:String;
            public var stateArray:ArrayCollection=new ArrayCollection();
            public var obj:Object="SELECT";
            // [Bindable]

            public function doNewSearch():void {

            public function onResult(oEvent:ResultEvent):void

            _xmlResult = XML(oEvent.result);
            // stateArray = oEvent.result as ArrayCollection;
            //stateArray=_xmlResult.TSpeciallisation.item.Atext as ArrayCollection;

            _xlDataSpecial =_xmlResult.TSpeciallisation.item.Atext;

            // _xlDataSpecialID=_xmlResult.TProficency.item.ScaleId;


            _sAppno= _xlDataProfi[0].toString();




            _xlDataAdv =_xmlResult.TAdvertisement.item.Iname;

            // Alert.show("value:"+ _xlDataProfiID.toString());
            Alert.show("value:"+ _xlDataSpecialID.toString());

            } //onResult

            public function changeProfi(event:Event):void
            // Alert.show("appno:"+ _sAppno);
            for(var i:Number=0;i<=_xlDataProfi.length();i++)
            //Alert.show("len:"+ _xlDataProfi.length());
            if((_xlDataProfi .toString())==event.currentTarget.selectedItem)
            var Profino:Number=_xlDataProfiID
            // outputInfo.text+=event.currentTarget.selectedItem+ " " +
            // event.currentTarget.selectedIndex + "\n";


            public function changeSpecial(event:Event):void

            public function changeQualif(event:Event):void

            public function changeSkill(event:Event):void


            public function changeIndustry(event:Event):void
            public function changeDesig(event:Event):void


            public function changePosition(event:Event):void
            { ...............................


            public function changeAdv(event:Event):void


            • 3. Re: XMLList Problem
              Thenmalar Level 1
              public function submitfun():void
              // Alert.show("Print:"+firstname0.text); text="{WES3.ZhrFunApplicantCreate.lastResult.ApplicantNumber}"

              public function onResult2(Event2:ResultEvent):void

              Alert.show("Result value1:");
              _xmlResult2 = XML(Event2.result);

              outputInfo.text = _xmlResult2.toXMLString();
              Alert.show("Result value1:");
              // Alert.show("Result"+( _xmlResult.EX_EMPLOYID.text()).toXMLString());

              var xmlResultNode:XML = _xmlResult2.Applicantnumber[0];
              // var xmlDetailsNode:XML = xmlResultNode.Details[0];
              // output1.text = _xmlResult.toXMLString();
              _sAppno = xmlResultNode.text();
              Alert.show("Result value:"+_sAppno.toString());
              } //onResult

              public function cleardata():void
              ......................... }



              <mx:WebService id="WES2" destination="masterws" useProxy="true" fault="Alert.show(event.fault.faultString) , 'Error'" result="onResult(event)" >
              <mx:operation name="ZhrFunApplicantMasterdata" resultFormat="e4x" >



              <mx:WebService id="WES3" destination="applicantws" useProxy="true" fault="Alert.show(event.fault.faultString) , 'Error'" result="onResult2(event)" >
              <mx:operation name="ZhrFunApplicantCreate" resultFormat="e4x" >
              <!-- {(DOB0.text) as Date} -->






              <mx:Panel x="114" y="0" width="1138" height="1600" layout="absolute" autoLayout="true" backgroundColor="#FFFFFF">
              <mx:TextInput id="Adv" text="00000001"
              width="175" x="118"/>
              <mx:TextInput id="Result" text="{WES3.ZhrFunApplicantCreate.lastResult.ApplicantNumber}"

              width="268" x="425" y="0"/>
              <mx:HBox x="55" y="197" width="100%" height="42">
              <mx:Label text="Position Applied For:" width="123"/>
              <mx:ComboBox dataProvider="{_xlDataPostn}" change="changePosition(event)" width="118"></mx:ComboBox>
              <mx:Label text="Advertisement:"/>
              <mx:ComboBox dataProvider="{_xlDataAdv}" change="changeAdv(event)" width="118"></mx:ComboBox>

              selectedItem="Translator" change="changeSpecial(event)"
              <mx:VRule height="31" width="3"/>
              <mx:TextInput width="276"/>
              <mx:VRule height="31" width="3"/>
              <mx:VRule height="26" width="0"/>
              <mx:TextInput width="84"/>
              <mx:VRule height="31" width="4"/>
              <mx:DateField width="138"/>
              <mx:VRule height="31" width="3"/>
              <mx:DateField width="126"/>
              <mx:HBox width="981" height="28">
              <mx:ComboBox dataProvider="{_xlDataQualif}" width="112"></mx:ComboBox>
              <mx:VRule height="31" width="3"/>
              <mx:ComboBox dataProvider="{_xlDataSpecial}" width="135"></mx:ComboBox>
              <mx:VRule height="31" width="3"/>
              <mx:TextInput width="276"/>
              <mx:VRule height="31" width="3"/>
              <mx:VRule height="26" width="0"/>
              <mx:TextInput width="84"/>
              <mx:VRule height="31" width="4"/>
              <mx:DateField width="138"/>
              <mx:VRule height="31" width="3"/>
              <mx:DateField width="126"/>


              <mx:VBox x="55" y="1091" height="269" width="776">
              <mx:Text text="Resume:" width="180" fontSize="13"/>
              <mx:TextArea height="236" width="719" id="outputInfo"/>
              <mx:HBox x="370.5" y="1426" width="133" height="32">
              <mx:Button label="SAVE" click="submitfun()"/>
              <mx:Button label="RESET" click="cleardata()"/>


              <mx:HBox x="55" y="305" width="869" height="253">
              <mx:Form width="333" height="222">
              <mx:FormItem label="Firstname">
              <mx:TextInput id="firstname0"
              <mx:FormItem label="Lastname">
              <mx:TextInput id="lastname0"
              <mx:FormItem label="Gender">
              <mx:TextInput id="gender0"
              <mx:FormItem label="Address1">
              <mx:TextInput id="address0"
              <mx:FormItem label="Address2">
              <mx:TextInput id="address3"
              <mx:Form height="220" width="455">
              <mx:FormItem label="City">
              <mx:TextInput id="city0"
              <mx:FormItem label="Postal Code">
              <mx:TextInput id="postalcode0"
              <mx:FormItem label="Date Of Birth">
              <mx:TextInput id="DOB0"
              <mx:FormItem label="EmailId">
              <mx:TextInput id="emailid0"
              <mx:FormItem label="Phone No">
              <mx:TextInput id="phno0"
              <mx:Label x="320" y="2" text="Result:" width="70"/>


              onResult2() funtion is not been called.........
              i don't know y?????

              Then malar
              • 4. Re: XMLList Problem
                ntsiii Level 3
                It should be. Try putting the result handler specification on the operation instead of on the main Webservice tag.

                Are you suer send() is being called? There is no fault?

                • 5. Re: XMLList Problem
                  ntsiii Level 3
                  Also, using declaritive binding to build the Request object is hard to debug.

                  Do it in as, so you can be sure you have good values. the malformed xml error in your other post could occur if on of your bound values is null or undefined.

                  • 6. Re: XMLList Problem
                    Thenmalar Level 1
                    Thanks 4 ur Solution Nitsii.. i try that.I don't know how to pass the set of different Data types as a Node to a webservice through XML format... can u plz guide me.. & regarding the XML error ,The values are getting updated at the Backend. it gives me the error while processing the Result. I am using SAP as the Backend. so in SAP the Applicant Number(Result) is generated Properly.
                    but i couldn't get the result in my Flex....could u plz find me the solution for my queries???
                    thank u.

                    • 7. Re: XMLList Problem
                      Thenmalar Level 1
                      Hi ntsiii,
                      I just want to simplyfy my Qurey, that is how to pass Complex structures to Webservice.Actually i tried with Action Script
                      Class Employee{
                      Public Var FirstName: String;
                      Public Var LastName: String;
                      Public Var salary: Number;

                      In my Mxml file,
                      i have imported the Action Script class & create an object
                      Employee emp=new Employee();

                      but in my Action Script file i need to call one more complex structure Education which contains some 4 different data types
                      I don't know how to do that .......
                      Is this the Procedure to access Complex structure???
                      Could u please help me

                      • 8. Re: XMLList Problem
                        ntsiii Level 3
                        I am not familiar enough with web services to know how to pass complex objects, sorry. Maybe there are some examples in the SAP documentation.

                        But if SAP is getting the data correctly as is, just leave it as is.

                        One debug option is to change the resultFormat of your data service call to "text". This way you can get the string, and paste it into an xml debugger.