AXIS2 - List - ArrayList - Arrays - Objects - Dilema?


XML & Web services: AXIS2 - List - ArrayList - Arrays - Objects - Dilema?

  1. Hi, 

    Currently I have component of which one of the interfaces is web service interface. Now this components has its own Data classes which contains List and ArrayList of other complex data classes as they are easy to maintain and in use. 

    To expose the same component as web service I convert all those List/ArrayList into Arrays otherwise as you know axis2 will say its an object of 'anyType' and it works fine. But there are two major problem with this approach i.e. 
    1) Now I have two set classes, one Data type for List/ArrayList representation which are in use by my business logic and one for Array (only useful for WS interface). 
    2) Off-course there is an performance overhead for converting each request/response from List/ArrayList to Array passing to/from my business logic. 

    Possible solution to avoid both of the above problems is to replace all my List/ArrayList to an Array so I can have one set of Data classes which will used by both Business Logic and WS interface but the downside is that Arrays comes with all sorts of problems and they very hard to maintain. Secondly I have rewrite and re-test everything (which is not a very big deal, it is doable). 

    Other option is to keep the architecture same and have two set of classes which is not clean and good. 

    Could you please help me decide which approach I should go forward with? Your suggestions and help will be appreciated. 

    Note: In future there will be more components with its own Data classes and each will have its own WebService Interface. 




  2. I have asked this question but didn't get response, but want to share my approach which might be use full for others.

    I used List<ArrayLost> to store my data but changed the inetrface to Array[]. This is bit expensive as I have to do many conversions but when data length is un-known this is the best solution I guess.

    Hope this helps.