Axis-C++
  1. Axis-C++
  2. AXISCPP-621

Support for the WSDL construct choice

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5 Final
    • Fix Version/s: None
    • Component/s: WSDL processing - RPC
    • Labels:
      None
    • Environment:
      All

      Description

      Axis C++ doesn't support the WSDL construct "choice".

      1. Choice.wsdl
        4 kB
        Marcus Dushshantha Chandradasa
      2. ChoiceTest.wsdl
        4 kB
        Marcus Dushshantha Chandradasa

        Activity

        Hide
        Samisa Abeysinghe added a comment -
        Show
        Samisa Abeysinghe added a comment - http://www.w3schools.com/schema/el_choice.asp is a useful reference
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        The attached file Choice.wsdl can be used to test the wsdl construct "choice". This file was taken from Axis Java.

        Show
        Marcus Dushshantha Chandradasa added a comment - The attached file Choice.wsdl can be used to test the wsdl construct "choice". This file was taken from Axis Java.
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        The original wsdl file in Axis java was ChoiceService.wsdl. We renamed it as Choice.wsdl because we use the same wsdl file to generate both the service and the client.

        Show
        Marcus Dushshantha Chandradasa added a comment - The original wsdl file in Axis java was ChoiceService.wsdl. We renamed it as Choice.wsdl because we use the same wsdl file to generate both the service and the client.
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        In this problem, we can identify two defferent problem areas that we have to look in to.

        1. wsdl2ws tool changes
        2. Deserialization changes

        1. wsdl2ws tool changes
        --------------------

        1.1

        First the tool should decide whether there is a choice construct in the wsdl file.

        1.2

        When we come across a choice, the tool has to generate code accordingly. The changes should be in the deserialization part of the complex type.

        2. Deserialization changes
        -----------------------

        2.1

        First, we need to know out of the possible choices which choice is available. For this, we neet to get the element name from the parser level and compare the name with possible choices at the generated code level.
        This can be done by a method implemented in xml parser which can be named as getChoiceName(), which returns the element name. This method should be accessed by the genrated code through the Deserializer because stub level doesn't have the direct access to parser. This element name can be compared with the available choices and the correct choice can be selected for deserialization.

        2.2

        Once the starting tag is pulled in advance, we cannot use the current deserializer code as it is to deserialize the rest because it assumes that the start tag would be there.
        need to have a design to overcome this problem.

        2.3

        Once the choice is known, we have to pull the multiple occurances of the choice based on min-occurs and max-occurs.
        we can do this by having a method in parser to return whether there is a next occurance, which can be named as hasChoiceNext() which returns a boolean value.

        Show
        Marcus Dushshantha Chandradasa added a comment - In this problem, we can identify two defferent problem areas that we have to look in to. 1. wsdl2ws tool changes 2. Deserialization changes 1. wsdl2ws tool changes -------------------- 1.1 First the tool should decide whether there is a choice construct in the wsdl file. 1.2 When we come across a choice, the tool has to generate code accordingly. The changes should be in the deserialization part of the complex type. 2. Deserialization changes ----------------------- 2.1 First, we need to know out of the possible choices which choice is available. For this, we neet to get the element name from the parser level and compare the name with possible choices at the generated code level. This can be done by a method implemented in xml parser which can be named as getChoiceName(), which returns the element name. This method should be accessed by the genrated code through the Deserializer because stub level doesn't have the direct access to parser. This element name can be compared with the available choices and the correct choice can be selected for deserialization. 2.2 Once the starting tag is pulled in advance, we cannot use the current deserializer code as it is to deserialize the rest because it assumes that the start tag would be there. need to have a design to overcome this problem. 2.3 Once the choice is known, we have to pull the multiple occurances of the choice based on min-occurs and max-occurs. we can do this by having a method in parser to return whether there is a next occurance, which can be named as hasChoiceNext() which returns a boolean value.
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        Found a better wsdl file test Choice construct. The original file Round4XSDTest.wsdl was taken from http://mssoapinterop.org/asmx/xsd/ and modified according to our needs with the name ChoiceTest.wsdl which is attached here.

        Samisa, Thank you for helping me to find suitable wsdl files.

        Show
        Marcus Dushshantha Chandradasa added a comment - Found a better wsdl file test Choice construct. The original file Round4XSDTest.wsdl was taken from http://mssoapinterop.org/asmx/xsd/ and modified according to our needs with the name ChoiceTest.wsdl which is attached here. Samisa, Thank you for helping me to find suitable wsdl files.
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        i managed to solve half the problem. Chinthana implemented a peek mechanism in xml parser which allows the deserializer to identify the name of the next element from the xml stream. I used that mechanism in the generated stub level codes to get the next element name and deserialize only that element. This is done if and only if the perticular element is a wsdl choice.

        I changed the wsdl2ws tool to generate codes accordingly. now it works for nillable types and simple types with 1 occurrence. This is working only for document style. These changes now are in the cvs.

        Have to look in to unbounded occurrences.

        i'm planning to add three tests in to the test framework.
        1. Test for nillable types
        2. Test for Simple types (two seperate tests for rpc and doc/lit)
        3. Test for unbounded occurrences

        Show
        Marcus Dushshantha Chandradasa added a comment - i managed to solve half the problem. Chinthana implemented a peek mechanism in xml parser which allows the deserializer to identify the name of the next element from the xml stream. I used that mechanism in the generated stub level codes to get the next element name and deserialize only that element. This is done if and only if the perticular element is a wsdl choice. I changed the wsdl2ws tool to generate codes accordingly. now it works for nillable types and simple types with 1 occurrence. This is working only for document style. These changes now are in the cvs. Have to look in to unbounded occurrences. i'm planning to add three tests in to the test framework. 1. Test for nillable types 2. Test for Simple types (two seperate tests for rpc and doc/lit) 3. Test for unbounded occurrences
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        hmm, choice is complete for Doc/Lit style. 3 new tests were added to the test framework to test 'choice' construct as follows;

        1.BasicChoice - to test string type choice elements
        2.SimpleChoice - to test Simple type choice elements
        3.UnboundedChoice- to test simple type unbounded choice elements

        All these test are document style tests. Have to test for rpc as well. They also should work properly.

        All the modifications are in the cvs.

        Thanks,
        Dushshantha

        Show
        Marcus Dushshantha Chandradasa added a comment - hmm, choice is complete for Doc/Lit style. 3 new tests were added to the test framework to test 'choice' construct as follows; 1.BasicChoice - to test string type choice elements 2.SimpleChoice - to test Simple type choice elements 3.UnboundedChoice- to test simple type unbounded choice elements All these test are document style tests. Have to test for rpc as well. They also should work properly. All the modifications are in the cvs. Thanks, Dushshantha
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        The support for 'choice' WSDL construct in Axis C++ is implemented.

        Show
        Marcus Dushshantha Chandradasa added a comment - The support for 'choice' WSDL construct in Axis C++ is implemented.
        Hide
        Marcus Dushshantha Chandradasa added a comment -

        the WSDL construct 'choice' is now supported by Axis C++ server. Five new tests were also added to the test framework to test several cases.

        Generating Getters and setters of the attributes of generated classes is yet to be done. It was addressed in a seperate Jira issue, so i decided to close this issue first and fix the getters and setters problem seperately.

        Show
        Marcus Dushshantha Chandradasa added a comment - the WSDL construct 'choice' is now supported by Axis C++ server. Five new tests were also added to the test framework to test several cases. Generating Getters and setters of the attributes of generated classes is yet to be done. It was addressed in a seperate Jira issue, so i decided to close this issue first and fix the getters and setters problem seperately.

          People

          • Assignee:
            Marcus Dushshantha Chandradasa
            Reporter:
            Marcus Dushshantha Chandradasa
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development