by Scott Balmos
About a month ago, I wrote a blog entry here discussing stateful web services, and how EJB3 more or less removed the commonly used J2EE hack, in using the serialized EJB2.1 Stateful Session Bean Handle as a session token of sorts. I mentioned how JAX-WS added support for a WS-Addressing-based stateful SOAP endpoint - the first truly “automated” and SOAP-compliant manner of providing sessions in SOAP. Now… we have sample code! It really is dead-simple, a testament to the WSIT group (Project Tango), working between Sun and Microsoft to make JAX-WS and the Windows Communication Framework in .Net 3.0 play nicely.
First, the client code. This is run under JAX-WS 2.1.2 running in Glassfish v2 Beta 2. As part of the deployment, we won’t run wsgen to build the WSDL file or server artifacts, leaving that to deployment time auto-generation (all hail JEE 5). So, you can also run this example in WebLogic 10, if you updated the JAX-WS components in it to at least 2.1 (WL10 comes with JAX-WS 2.0 if I remember correctly). The JBoss crowd probably will work also under a JBoss 5 beta, as long as you use the JAX-WS libs. JBossWS will not work (at least not as pretty). Read more »