aspose file tools*
The moose likes Web Services and the fly likes Sorting from two or more Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Sorting from two or more Web Services" Watch "Sorting from two or more Web Services" New topic
Author

Sorting from two or more Web Services

Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
to create a new Service . Is that possible or advisable and what should one look for ?

Thank you.


Le Cafe Mouse - Helen's musings on the web - Java Skills and Thrills
"God who creates and is nature is very difficult to understand, but he is not arbitrary or malicious." OR "God does not play dice." - Einstein
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Can you give us a small example or scenario ?


Spritle Software Blogs
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
A Service is a group of components to get a particular job done.

A new Service is an aggregate of two other Services with a few additional components but needs the messages from the other Services sorted by, say, a date.

One could sort XML files but wondered if there was a pattern that was more event driven.

Event Driven Consumer Pattern ?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
What do you mean by "the messages from the other Services"? The incoming SOAP requests? The outgoing SOAP responses? Something else? What is this "date" you'd like to sort on?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
Well, the aggregate Service would send a request to each of the other Services and get replies. Imagine there's a date on the replies denoting expiry dates of a product and the Service needs to sort on dates expiring early to use those first.
[ August 04, 2004: Message edited by: Helen Thomas ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Ok. Sure. The new service can do that, convert the "records" it gets back into a common object representation, sort them, and do something with the one which expires first.
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
Without the Service having to specifically sort is there a way of making sure that replies fitting specific criteria like early expiry dates preceed later ones. It would be useful to have some middle Service layer doing this rather than re-inventing the wheel each time. The two Services sending replies don't know anything about each other.
[ August 04, 2004: Message edited by: Helen Thomas ]
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
Thinking about it the latter is probably overkill.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Helen Thomas:
Without the Service having to specifically sort is there a way of making sure that replies fitting specific criteria like early expiry dates preceed later ones. It would be useful to have some middle Service layer doing this rather than re-inventing the wheel each time.

You can't escape sorting the messages somewhere. Whether it's your new aggregating web service or a broker through which your aggregating web service invokes the back-end web services, someone somewhere has to figure out which of the currently available messages has the earliest expiry date. I strongly suggest starting out by putting the sorting stuff into the aggregating web service.
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
Thanks Lasse that was helpful.

Amazon lets one build Web Services from their site. I'll take a peek and see what how they approach any similar problem.
 
 
subject: Sorting from two or more Web Services