Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sorting from two or more Web Services

 
Helen Thomas
Ranch Hand
Posts: 1759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to create a new Service . Is that possible or advisable and what should one look for ?

Thank you.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give us a small example or scenario ?
 
Helen Thomas
Ranch Hand
Posts: 1759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Helen Thomas
Ranch Hand
Posts: 1759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thinking about it the latter is probably overkill.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic