Monday February 27, 2006
Java SE 6: Mustang and WS-TMI
Filed under:
javase6
Did you know that Java SE 6,
Mustang, features
a subset of the Java EE Web Services stack ?
I've been tinkering with it, check it: Its
JAX-WS (
JSR 224) with a helping
of
JAXB (
JSR 222) for its data
binding, a good dollop of
WS
Metadata Annotations (
JSR
181), with a sprinkling of a few of its own. Of course you've
already teased a coulis of
XML strained
with
WSDL in a
JAX-RPC boullion
with sun-dried
MTOM/
XOP and hand-crushed
swaRef...
Yawn, W H A T E V E R . Too much information. Way.
Let's try it this way around....you have a neat little program, see ?
It does something cute like adding a couple of numbers, which is
self-evidently your market-dominating online
service in thin disguise:
public class NumberAdderUpperer {
public int addNumbers(int number1, int number2) {
return number1 + number2;
}
}
And naturally, you know you want to tell all your friends to use it, so in
Mustang, they made it so you can do this:
import
javax.jws.WebService;
@WebService
public class NumberAdderUpperer {
public int addEmUp(int
number1, int number2) {
return number1 + number2;
}
}
OK, so now you'd hit deploy in your IDE of course and stick it on the
corporate app server, tell the world, and be done. But for the slightly
more cautious amongst you, let's you and I do it with nothing more than
the Mustang SDK, which has its own mini-Http server just for things
like this:-
import
javax.xml.ws.Endpoint;
...
Endpoint.publish("http://localhost:8080/ws-tmi/adderupperer", new NumberAdderUpperer ());
Oops ! And now your new number adding service is published at:
"http://<hostname>:8080/ws-tmi/adderupperer".
Could it
BE any easier ? (actually, maybe you think it could - let me
know....)
And I did mention that adding numbers is an incognito book ordering or drug prescription authorisation
service, and your
soi-disant friends unmasked: they're your customers or patients, right ?
Ya, two imports and an annotation: that's the kind of simplicity I can go for.
Posted by dannycoward
( Feb 27 2006, 04:56:44 PM PST )
Permalink