|
|
||
Bhakti Mehta's BlogWeb Services and XML ArchivesRehash of WS Reliable Messaging (WS-RM) in Metro 1.0 and what's nextPosted by bhaktimehta on September 18, 2007 at 10:59 AM | Permalink | Comments (4)Project Metro is a new name for the JAX-WS + Project Tango combination. JAX-WS is the standardized web services stack and Project Tango is the Sun's Java Web Services interoperability project with Microsoft's Windows Communication Foundation (WCF). Project Metro is released and so is the release of GlassFish V2 FCS (b58g). GlassFish V2 Embeds the Metro 1.0 Stack within it thereby making WebServices functionality directly usable from GlassFish (without the need for any extra downloads or installations). WebServices Reliable Messaging (WS-RM) is one of the enterprise features in Project Metro. Now we shall have a brief rehash of WS-RM in Metro 1.0 and what would be the new features in upcoming releases WS Reliable Messaging in Metro 1.0 WS-RM 1.0 is based on the following standards The programming model when developing webservices applications with Metro is the same old JAXWS Programming Model and nothing new is required to be learned. Adding WS-RM, Security and other Quality of Service features to the JAXWS webservice is enabled via configuration files which can be handwritten or easily edited by Netbeans. WS-RM is enabled in endpoints by the presence of RM policy assertions in the WSDL. Netbeans IDE will provide configurable settings to easily enable RM in endpoints. Here is a brief overview of WS-RM. The tutorial provides detailed instructions on how to work with Metro. This is a screen cast which show how to easily enable WS-RM when working with Netbeans. For more information , instructions on how to use Netbeans with GF are also available here. Future plans for WS Reliable Messaging 1.1
Obtaining and analyzing thread dumpsPosted by bhaktimehta on May 25, 2007 at 01:09 PM | Permalink | Comments (4)Most of us run into bugs where tests "hang". Here are some nice tools and tips I found to obtain and analyze thread dumps. I am sure there may be other tools so if you know of some good ones feel free to add. Jstack jstack prints Java stack traces of Java threads for a given Java process or core file or a remote debug server. However jstack is not available for Windows platforms or on the Linux platform. Stacktrace Stacktrace has great features which include 1. Thread dump for Java processes running as a Windows service (like Tomcat, for example), started with javaw.exe or embedded inside another process. 2. Thread dump for any applet running inside any browser (Apple, IBM and Sun JDKs for Windows and Mac OS X). StackTrace is known to work with IE, Firefox, Safari and Mozilla. and many other features..
I usually get the java process id using jps On UNIX platforms you can send a signal to a program by using the
kill
command. This is the quit signal, which is handled by the JVM.
For example, on Solaris you can use the command kill -QUIT
process_id, Alternatively you can enter the key sequence <ctrl>\ in
the window where the Java program was started. Sending this signal
instructs a signal handler in the JVM, to recursively print out all the
information on the threads Byron Nevins has also pointed in his blog how
to obtain thread dumps in Glassfish.
I especially liked the ability to filter the threads display to be able
to ignore e.g. idle threads.. Also as you can see in Fig 1 The three
pane view is really helpful
Update to Developing Webservices using Glassfish AS 9.1 and JDK 6Posted by bhaktimehta on January 24, 2007 at 12:10 PM | Permalink | Comments (1)In the previous blog
we tried running glassfish-samples using Glassfish
v2 using
JDK 6. The latest Glassfish v2 installs webservices-api.jar in $AS_HOME/lib/endorsed. and hence we do not need to put javaee.jar there. So here is the updated blog. Steps to run the sample with JDK 6 Install JDK 6 from http://download.java.net/jdk6/binaries/ Install GlassFish
v2 You can install the latest nightly or the latest promoted v2
build from
https://glassfish.dev.java.net/public/downloadsindex.html For those users who have already installed GlassFish and wish to change the JDK version. That's equally simple. The JDK path is stored in one location :
Download the glassfish-samples from the following site https://glassfish-samples.dev.java.net/
javaee.home="location of Glassfish"
/usr/glassfish-samples/javaee5/webservices %java -version
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b104, mixed mode, sharing)
Start Appserver /usr/glassfish/bin %$AS_HOME/bin/asadmin* start-domain domain1 Run the Sample
/usr/glassfish-samples/javaee5/webservices/hello-jaxws %ant Buildfile: build.xml
<sysproperty key="java.endorsed.dirs" value="${javaee.home}/lib/endorsed"/>
Also for ant tasks like wsimport,xjc :
The solution is to copy $AS_HOME/lib/endorsed/webservices-api.jar
to $JAVA_HOME/jre/lib/endorsed. Neither jvmargs nor sysproperty will work in this case Developing Webservices using Glassfish AS 9.1 and JDK 6Posted by bhaktimehta on January 02, 2007 at 11:08 AM | Permalink | Comments (2)This blog will show how to develop, run and deploy
JAX-WS based webservices with Glassfish v2 Milestone 3 build using
JDK 6. What is different when trying
with JDK 6? To avoid this we need to use the endorsed standards to override the
2.0 apis by
putting javaee.jar in $AS_HOME/lib/endorsed. Steps to run the sample with
JDK 6 Install JDK 6 from http://download.java.net/jdk6/binaries/ Install GlassFish
v2 Milestone 3 Install from
https://glassfish.dev.java.net/public/downloadsindex.html For those users who have already installed GlassFish and wish to change the JDK version. That's equally simple. The JDK path is stored in one location :
Download the glassfish-samples from the following site https://glassfish-samples.dev.java.net/
Add javaee.jar to $AS_HOME/lib/endorsed As mentioned earlier this extra step will be required for running with JDK 6.0
/usr/glassfish/bin %$AS_HOME/bin/asadmin* start-domain domain1 Run the Sample
<path id="classpath">
<pathelement location="${javaee.home}/lib/endorsed/javaee.jar"/>
<pathelement location="${classesdir}"/>
</path>
/usr/glassfish-samples/javaee5/webservices/hello-jaxws %ant Buildfile: build.xml
WS-Reliable Messaging and Session Support (Part2)Posted by bhaktimehta on August 21, 2006 at 03:29 PM | Permalink | Comments (0)This is Part 2 in a series of articles on supporting sessions using WS-ReliableMessaging. In this blog Mike Grogan compares HttpSessions and ReliableSessions and demonstrates the problems with the approach taken in Part 1 WS Reliable Messaging and Session Support (Part1)Posted by bhaktimehta on August 02, 2006 at 02:31 PM | Permalink | Comments (1)Java™ Technology-Based Project Tango and Microsoft Indigo" TS-1603 at Javaone 2006. This is a part of tri series blogs where in Part 1 we will show one way of supporting sessions with WS Reliable Messaging. Then Mike will show in his blog what are the problems with this approach and we will conclude with a third part where we have tried to fix some of these problems . Sessions are unique ids used to identify a client. They would help maintain state for each client. In this sample you will see how sessions can be supported with WS Reliable Messaging (WS RM) . WS RM is one of the enterprise features in Project Tango which is Sun's Java Web Services interoperability project with Microsoft's Windows Communication Foundation (WCF). The following snippets of code show how the JAX-WS Endpoint implementation which is RM enabled supports sessions . This is the wsdl which shows RM is enabled in the endpoint by the presence of WS-RM Policy Assertions. Here is endpoint implementation class @WebService(endpointInterface="rmdemo.server.RMDemo") We create a HashTable of SessionIds as the keys and Strings which are entered by the clients as the values. private final HashTable<String,String> sessionTable = JAX-WS uses annotations defined by Common Annotations for the Java Platform (JSR 250), to inject the Web ServiceContext and declare lifecycle methods. Web ServiceContext holds the context information pertaining to a request being served. With JAX-WS Web Service all you need to do is mark a field or method with @Resource. From the WebServiceContext, MessageContext pertaining to the the current request can be accessed. More information on how MessageContext can be used to share metadata is explained in this article. @Resource As mentioned above WebServiceContext exposes the MessageContext for the request being served when this method is called . The session id is obtained from the MessageContext using a jax-ws property "com.sun.xml.ws.sessionid" private String getSessionId() {
The following getter method returns the String associated with each request . Correspondingly the setter method stores the Strings for each session in the HashTable respectively. private String getSessionData() {
These addString method and getResult method are exposed by our RM endpoint. The method addString takes a String as entered by a user and adds it to the Strings stored in the session data for that session. The getResult will return all the strings entered by the user during that session. @WebMethodThis example is a good demonstration of how InOrder delivery assurance (i.e messages are delivered in the order that they are sent) in WS Reliable Messaging works. If the ordered delivery would not work right then the strings stored in the session would not have been in the right order. Full source code for the RMDemoImpl.java is here. Client Code Here is the source code for the client. The client enters various input Strings and finally hits carriage return to terminate the client application and all the Strings received so far for that client will be returned by the server. Sample will be bundled in the samples folder. Instructions to run the sample Please follow the Readme to setup and run the sample. For any questions or feedback on the sample please write to users@wsit.dev.java.net Additional sources of information WSIT website Check this website for latest source code, samples,documentation All WSIT technologies can be installed on this FREE app server Netbeans IDE Module: All WSIT technologies available today can be configured visuall using this Netbeans module. Slides for TS 1603 Reliable and Transacted Web Services between Java™ Technology-Based Project Tango and Microsoft Indigo at Javaone 2006 Maintaining Session With JAX-WS JAXB 2.0 and JAX-WS 2.0 are a part of Mustang (JDK 6.0)Posted by bhaktimehta on August 08, 2005 at 04:18 PM | Permalink | Comments (2)Delivering Web Services is one of the primary themes for Mustang (Java SE 6). Our goal is that JSE will provide reasonable support for ease of development for the web services stack. This will primarily be client-side focused with a lightweight server to support callbacks. The main specifications are the Java Architecture for XML-Web Services (JAX-WS) 2.0 (formerly known as JAX-RPC) and Java Architecture for XML Binding (JAXB) 2.0. JSR 224 is defining JAX-WS 2.0. This is a major update since the JAX-RPC 1.0 specification incorporating new specifications and updates to existing standards. JAX-WS 2.0 now delegates the databinding related tasks to JAXB 2.0. JSR 222 is defining JAXB 2.0. It adds significantly to JAXB 1.0, including 100% XML schema support, the binding of Java classes to XML schema, the meeting of data binding requirements for JAX-WS 2.0, and schema evolution support. A flexible binding allows an application to bind only parts of an XML document (relevant to the application) to Java. Mustang has the webservices features integrated as of b40. You can try the latest snapshot from https://mustang.dev.java.net/ We are fixing and integrating bugs on a regular basis. Please let us know about your bugs, you can file them at There are 4 new scripts added in the jdk6.0/bin which are as follows xjc, schemagen , wsimport and wsgen /path/to/jdk6.0/bin/xjc foo.xsd -p test.foo Similarly to invoke the schema generator to generate schemas from Java sources /path/to/jdk6.0/bin/schemagen Foo.java To generate portable artifacts from wsdls and external jaxws or jaxb binding files you can use wsimport /path/to/jdk6.0/bin/wsimport stock.wsdl -b stock.xml -b stock.xjb To generate portable artifacts from Java sources you can use wsgen /path/to/jdk6.0/bin/wsgen example.Stock Javadocs for jdk6.0 Forums List of Committed bugs in the latest snapshot release More information on JAXB and JAXWS | ||
|
|