• Post Reply Bookmark Topic Watch Topic
  • New Topic

WS for existing application

 
Lidia Cyc
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello gurus,

I've never coded web services earlier, but now I have to develop
a service for a pretty old and complicated application.

I use AXIS and the problem I am expecting is as follows:

I have to deliver beans that include ArrayLists, Vectors and Hashtables.
While creating new beans for use with WS, AXIS replaces Hashtables with Hashmaps, ArrayLists with object arrays, and just Vectors are left as they are. As I already mentioned, the application is large and old and there is no way I can replace Hashtables and ArrayLists in the existing beans to fit
The AXIS/SOAP requirements.

My first idea was to create a new set of beans that will include Hashmaps and Vectors instead of Hashtables and ArrayLists to avoid the problems with AXIS/SOAP complex types mapping, and to build an introspection mechanism in my WS-handler class that will receive the new type of beans, parse them into the old types, trigger the existing system logics, introspect the old type beans received from the application back into the new types of beans and send a response back to the client.

But then I realized that Hashmaps and Vectors won't solve the problem in case the client will be written in .NET. Which means I can't even use Hashmaps and Vectors, but just arrays of objects. In case of Vectors this also can be solved, but I'm pretty puzzled how can the Hashmaps be represented in this case.

Anyway, my questions are:
1. Do you think the two bean types plus introspection scenario is the right one, or there are any other better solutions around?
2. Should I use Vectors and Hashmaps instead of ArrayLists and Hashtables, or the right way is to go down with simple arrays of objects?
3. If the answer to the second question is positive, how can Hashtables be represented by arrays of objects?

Thank you for your time!
 
Watsh Rajneesh
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For interoperability sake (in case you want .NET/some other non java platform webservice client to be able to access your webservice) you must not use java collections framework API, not even Vectors. So the option to go for is 2nd one in your list. To map a Hashtable/HashMap to an object array it will essentially be an array of wrapper objects where each object instance will represent one key-value pair.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To maximize interoperability look into designing a Document-Oriented Web Service WSDL-first (i.e. designing the XML documents that are used to exchange the data).
Patterns and Strategies for Building Document-Based Web Services
4.3 Designing XML-Based Applications
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!