4 Replies Latest reply on Jul 11, 2007 1:25 AM by Thenmalar

    How to pass Complex structures to webservices

    Thenmalar
      Hi ,
      How to pass the User Data in the form of Complex Structures to webservices becoz my WSDL file includes more number of tables as a request parameter . there is a data inside that tables.i want to pass the set of details from my flex builder to that fields which is inside the tables.
      for Example: The following code are from my WSDL file.
      ..............................
      <xsd:complexType name="Zbapieduc">
      - <xsd:sequence>
      <xsd:element name="FromDate" type="n0:date" />
      <xsd:element name="ToDate" type="n0:date" />
      <xsd:element name="EducEst" type="n0:char2" />
      <xsd:element name="EducTra" type="n0:numeric8" />
      <xsd:element name="Institute" type="n0:char80" />
      <xsd:element name="Cntry" type="n0:char3" />
      <xsd:element name="Certific" type="n0:char2" />
      <xsd:element name="BrStudy1" type="n0:numeric5" />
      <xsd:element name="BrStudy2" type="n0:numeric5" />
      <xsd:element name="Mark" type="n0:char4" />
      </xsd:sequence>
      </xsd:complexType>
      ........................................
      <xsd:complexType name="TableOfzbapieduc">
      - <xsd:sequence>
      <xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:Zbapieduc" />
      </xsd:sequence>
      .......................................................
      <xsd:element name="ZhrFunApplicantCreate">
      - <xsd:complexType>
      - <xsd:sequence>
      <xsd:element name="Address1" type="n0:char60" />
      <xsd:element name="Address2" minOccurs="0" type="n0:char40" />
      <xsd:element name="Advert" minOccurs="0" type="n0:numeric8" />
      <xsd:element name="BDate" minOccurs="0" type="n0:date" />
      <xsd:element name="City" type="n0:char25" />
      <xsd:element name="Cntry" minOccurs="0" type="n0:char3" />
      <xsd:element name="EMail" minOccurs="0" type="n0:char241" />
      <xsd:element name="Education" minOccurs="0" type="tns:TableOfzbapieduc" />
      <xsd:element name="ExpStatus" minOccurs="0" type="xsd:string" />
      <xsd:element name="FName" type="n0:char25" />
      <xsd:element name="Gender" minOccurs="0" type="n0:char1" />
      <xsd:element name="LName" type="n0:char25" />
      <xsd:element name="PcdCity" type="n0:char10" />
      <xsd:element name="PreviousEmployment" minOccurs="0" type="tns:TableOfbapiemploy" />
      <xsd:element name="Qualification" minOccurs="0" type="tns:TableOfzbapiquali" />
      <xsd:element name="SText" minOccurs="0" type="xsd:string" />
      <xsd:element name="TelNo" minOccurs="0" type="n0:char14" />
      <xsd:element name="VacancyAssignment" minOccurs="0" type="tns:TableOfbapivacass" />
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      - <xsd:element name="ZhrFunApplicantCreateResponse">
      - <xsd:complexType>
      - <xsd:sequence>
      <xsd:element name="Applicantnumber" type="n0:numeric8" />
      <xsd:element name="Education" type="tns:TableOfzbapieduc" />
      <xsd:element name="PreviousEmployment" type="tns:TableOfbapiemploy" />
      <xsd:element name="Qualification" type="tns:TableOfzbapiquali" />
      <xsd:element name="Return" type="tns:Bapireturn" />
      <xsd:element name="VacancyAssignment" type="tns:TableOfbapivacass" />
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>

      This WSDL file get the Applicant details from the Flex & generate an Applicant Number as the Output for an Applicant.
      In that stage i don't know how to pass the Array values or Xml Values from Flex to store the details about Education table.

      If anyone find the solution plz let me know . I have been struggling a week for this
      Thanks in advance...

      Warm Regards,
      Thenmalar.v
        • 1. Re: How to pass Complex structures to webservices
          kcell Level 2
          Hello,

          so you got the information from the webservice call and just like to store the data temporarly in a variable.

          Have you already tried to store the data in a static object/array (or somewhere where it remains in memory)?
          Which problems did you achieve by storing the data (whereever you tried to store it) ?

          best regards,
          kcell



          • 2. Re: How to pass Complex structures to webservices
            Thenmalar Level 1
            Hi Kcell,
            I'm new to flex.No i don't have any idea regarding how to pass the parameters to static Object. But as for as i know XML Collection is used to pass the set of records which contains different datatypes .
            But i don't know in detail... Could u plz help me to solve out this issue..
            Thanks in advance..

            Regards,
            Then Malar
            • 3. Re: How to pass Complex structures to webservices
              kcell Level 2
              Hi Then Malar,

              I am still not sure if understood your problem, but we will try to figure out ;)

              So if your problem is to store the result temporaly you can use somethings like this:
              class applicantClass
              {
              ...
              public var m_resultEvent :ResultEvent;
              ...
              private function getZhrFunApplicantResponseHandler(event:ResultEvent):void
              {
              m_resultEvent = event.result;
              }
              ...
              }

              If your problem is to parse the result you might check two ways:
              1) check if you can use resultformat="object" for your webservice call, cause then flex take care about the serialzation)
              2) check the class SimpleXMLDecoder
              ( There might be some problems with dates /which was interpreted as strings ... check the Dateformat class from the actionscriptcookbook http://rightactionscript.com/ascb/ )

              Hope these ideas help you to solve your problem.

              Regards,
              Klaus
              • 4. Re: How to pass Complex structures to webservices
                Thenmalar Level 1
                Hi,
                Actually i want to send the XML Collection to the webservice.how do i do that?? i am able to store the information in this way
                [Bindable]public var _xmlResult:XML;
                [Bindable]public var _xlDataSpecial:XMLList;

                _xmlResult = XML(oEvent.result);
                _xlDataSpecial =_xmlResult.TSpeciallisation.item.Atext;
                this is how i fetch the data from the webservice.
                But now my problem is i need to send the set of records to the table at the backend using webservices the record may contain different data types. how do i send multiple records,
                What i'm trying means, i will store the details in XML Collection or XML & bind this XML Collection with the tag


                <mx:WebService id="WES3" destination="applicantws" useProxy="true" fault="Alert.show(event.fault.faultString) , 'Error'" >
                <mx:operation name="ZhrFunApplicantCreate" result="onResult2(event)" resultFormat="e4x" >
                <mx:request>
                <Address1>
                {address0.text}
                </Address1>
                <Address2>
                {address3.text}
                </Address2>
                <Advert>
                {Advno}
                </Advert>
                <BDate>
                {dob.text}
                </BDate>
                <City>
                {city0.text}
                </City>
                <Cntry>
                </Cntry>
                <EMail>
                {emailid0.text}
                </EMail>
                <Education>


                { XML Binding}

                </Education>
                ........................
                Actually this Education is in the Table format & able to store the records,
                But i don't know how to store the multiple data types in XML Collection or XML & how to pass that XML Collection to Webservice
                I hope i explained my problem as much as possible to u.
                Plz bring me an solution
                Thank u

                Regards,
                Thenmalar