Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Business professionals and administrators primarily deal in business categories or organizational entities—the nouns of their trade. By contrast, a developer's daily work centers on types. Everything that you manipulate through a programming language has a type. For instance, a variable might be an integer or a floating-point type, which both constitute primitive types. A variable can also be a string or a person—more complex object-type varieties. Each programming language presents a different type system that serves as the basic dictionary of your application's data.
Most languages also give you a way to define new types, built out of the language's basic types. When you create a person
type in Java, it might consist of firstName and lastName fields, both of which would be strings—a type that Java already provides. Writing a Java program typically involves creating
an increasingly sophisticated type system and defining operations (methods) on those types.
When you interact with a Web service from a Java program—whether that program is a servlet or standalone application—that Web service must be represented as a Java type or a series of types inside your program. Likewise, when you wish to advertise your Web service so that others can invoke it over the Web, you must define it with types that other programs across the network understand.
If you must consider only interaction between Java programs, you can just use the Java type system or the custom types you defined on top of the basic Java types, such as person. Java Remote Method Invocation (RMI) is a service-oriented framework that relies on the Java type system for service definition: if both programs are written in Java, they can just communicate on the Internet via RMI. XML-based Web services, on the other hand, require that you define a Web service in a type system not tied to any specific programming language; you must map types defined in a programming language to language-neutral types, and vice versa.
A service's type consists of the service's name, the names of the operations (methods) it offers, as well as the names and types of those methods' parameters and return types. Continuing my earlier example of a cruise reservation Web service, consider a programmer at the imaginary Theseus Cruise Lines. His company operates the Ship of Theseus, which travels between the island of Crete and the city of Athens in the Mediterranean Sea. The following simple Java interface describes a service's type—consisting of one method—that returns an array of strings with the cruise line's destinations. In the article's next section, we will convert this type definition to a non-Java-specific format.
public interface CruiseService {
public String[] cruiseDestinations();
}
In addition to a service's type, when you want to invoke someone else's Web service, you also must know the technical details of locating and connecting to that service. That typically means that a service provider must advertise its service's access points, or endpoints, and the protocols supported by those access points. The URL http://www.javaworld.com, for instance, specifies the HTTP protocol, and www.javaworld.com is the address used to contact the service (the service's endpoint).