Help Me....WebServices Question

Liza (archive)

Usenet Archive
Joined
Jun 23, 2003
Messages
28
Reaction score
0
Hi guys, i'm trying to build a web service.......

is there such thing as polymorphism in web services? i mean could i have two web services of the same name but different arguments such that i could construct the following use case

Actor : WebServiceRequestor

1. The use case begins when the web service is called with either a flight number and a date or a date, time, departure and destination or a date, destination and departure only as arguments.

2. If a flight number and date is supplied as arguments
2.1 If the flight specified exists on that date
2.1.1 The service returns the departure details of the flight (date time, airport, gate number, flight number)
3. If a date, time, departure and destination airports are supplied as arguments
3.1 If a flight with the specified details is found
3.1.1 The service returns the departure details of the flight (date time, airport, gate number, flight number).
4. If a date, destination airport and departure airport is supplied as arguments
4.1 If flights of the specified description exist on the specified date
4.1.1 The service returns a list of departure details for those flights.
5. The use case terminates.

or do i really need to split the above use case up into 3 (one for step 2, one for 3 and one for 4), each for one of three different web service.

Also, how do i get my web service to indicate error? Furthermore, how do i get my web service to indicate different kinds of errors? i guess my main question is.......... can i use exceptions with web services?

Finally,
Can i use API classes such as Date and Time with web services ??

Thank you very much.

Liza
 

Andy Dingley

Usenet Archive
Joined
Feb 23, 2000
Messages
3,303
Reaction score
0
Hi guys, i'm trying to build a web service.......

What's the background here ? Are you a student, or are you trying to build a live service ?
is there such thing as polymorphism in web services?

What's a "web service" ? In the geneal case, then of course there is
- "web service" is a broad term, could mean anything, could incorporate anything you build into it.

A better question is "Is it appropriate to build polymorphism into a web service built out of SOAP / built using WebSphere"

i mean could i have two web services of the same name but different arguments

"Polymorphism" can be defined to mean almost anything. A single entry point behaves differently, depending on some data item. At the crudest level, this is "passing a logic flag into a procedure". At the deepest level, it's a full-blown OO solution with virtual methods.

Now the OO view starts to require an object. And an object often brings with it notions of state. Now state is a bad thing in a web service, so be very careful about going down this route. How does a web service recognise the "type" of the call ? How persistent is this typed object ? Has its existence become more important than the procedural nature of the service ?

There's a school of thought that sees web services as a means to transmitting Java objects from place to place. I don't really hold with this style...

such that i could construct the following use case

If you're building polymorphic use cases, then look at the scope and detail of the use cases. You should be able to build n+1 use cases, one for the overall case, and one each for each of the polymorphic variants.

If you can't describe these use cases, then question whether it's appropriate to build the interface this way. If there isn't a way to write the generic use case, then is this really appropriate to be a polymorphic methor, or is it simply separate methods ?

Also, how do i get my web service to indicate error?

This is all described in the SOAP docs.
Furthermore, how
do i get my web service to indicate different kinds of errors?

There are two broad levels of error. "The web service broke" and "The application underlying the web service broke". SOAP has quite different ways to report these.

The first of these should never happen. So when they do, you're allowed to have the client go a little wild. This should be predictable, but you're allowed to do things like lose data and stop the booking process.

The second of these should be near seamless to the user. They will happen from time to time, and they should be handled in as non-disruptive way as possible.

Having said that, the two categories at the two levels don't map exactly. "Should never happen" isn't always just a SOAP error. "Web server a little busy, retrying in 5 seconds" shouldn't be fatal.

i guess
my main question is.......... can i use exceptions with web services?

What's an exception ? It's a GOTO statement - a sudden break in the flow of program execution. Now a web service is a modular program; it has one entry point and one exit point - so you _must_ still continue to that same exit point (perhaps returning a SOAP error). There can be no "exception" that pervades the WS interface, because the concept is basically meaningless (or at least undescribed).

Finally,
Can i use API classes such as Date and Time with web services ??

You can use anything you like "with" web services. You shouldn't pass anything _through_ the interface though, unless you can map it onto something clean and describable in XML Schema.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top