1 Reply Latest reply on Oct 22, 2007 6:41 AM by kcell

    Not able to pass cyclic XML schema type to a webservice method

    Kayalvizhi
      I have a webservice method called getData(GetDataDocument gDoc).
      I constructed a request with object (which exactly satisfy the XML schema def) to call up the getData(). [From my java client also I did the same; but the java classes have been generated using apache's xmlBeans; this works fine with the same kind of request].
      But the soap request constructed from flex does not get generated with all the values that I set in the request object.
      On further observation, I found out that if the schema involves cyclic elements, the soap request is not getting constructed as desired.

      My schema def:
      <complexType name="PredicateBagType">
      <sequence>
      <choice>
      <element maxOccurs="unbounded" minOccurs="0" name="PredicateBag" type="tns:PredicateBagType"/>
      <element maxOccurs="unbounded" minOccurs="0" name="BinaryPredicate" type="tns:BinaryPredicateType"/>
      <element maxOccurs="unbounded" minOccurs="0" name="UnaryPredicate" type="tns:UnaryPredicateType"/>
      </choice>
      </sequence>
      <attribute name="contextNode" type="tns:contextNodeIDType"/>
      <attribute default="false" name="negate" type="boolean"/>
      <attribute name="type" type="tns:PredicateBagTypeType"/>
      </complexType>

      Note that the PredicateBagType may contain another PredicateBagType.

      I have constructed my request with objects in my flex application . Though I have set the BinaryPredicate object in my PredicateBag object, the soap request constructed looks like this which is not desired

      <SOAP-ENV:Envelope xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
      <tns:get_Data maxPrograms="0" personalInfoUse="false" xmlns:tns="urn:tva:transport:2005">
      <tns:QueryConstraints>
      <tns:PredicateBag contextNode="1" negate="false" type="AND"/>
      </tns:QueryConstraints>
      <tns:RequestedTables>
      <tns:Table type="ProgramInformationTable"/>
      </tns:RequestedTables>
      </tns:get_Data>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>.




      If I comment out the PredicateBagType choice in my xsd, the flex application constructs the soap request looks like this.

      <SOAP-ENV:Envelope xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
      <tns:get_Data maxPrograms="0" personalInfoUse="false" xmlns:tns="urn:tva:transport:2005">
      <tns:QueryConstraints>
      <tns:PredicateBag contextNode="ProgramInformation" negate="false" type="AND">
      <tns:BinaryPredicate fieldID="Genre" fieldValue="Fiction" test="contains"/>
      </tns:PredicateBag>
      </tns:QueryConstraints>
      <tns:RequestedTables>
      <tns:Table type="ProgramInformationTable"/>
      </tns:RequestedTables>
      </tns:get_Data>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      This request holds good. But I cannot comment out the PredicateBagType from my choice. Is this an issue with soap request construction issue in Flex..?