heartin's blog

SOAP Binding Styles - DOCUMENT and RPC

SOAP Binding can be done using two styles: DOCUMENT and RPC. This is denoted in the wsdl as style in the binding section. 

The @SOAPBinding annotation can be used over an SEI (separate interface or class) to configure the soap binding styles, when developing a web service bottom up. Default is DOCUMENT. Annotate the SEI with @SOAPBinding(Style=Style.RPC) to get the RPC style. Generate a wsdl both with DOCUMENT and RPC styles and refer to them in parallel while going through these notes.


[Exercises] Additional Exercises based on SOAP Web Services

  1. Create a Web Service with a method that accept a String (as parameter) and Echo it back (return it).

    • Deploy the service on Glassfish application server

    • View and analyze the WSDL file and find the relationships with the class.

    • Test it using the Glassfish webservice tester

    • View and analyze SOAP request and SOAP response displayed by the tester.

[Lab-Analysis] Deploying a Bottum-up SOAP Web Service in Glassfish Server from Eclipse

We will quickly review the results of the lab @ http://javajee.com/lab-deploying-a-simple-soap-web-service-in-glassfish-....


The Web Service

We had deployed the below simple web service in Glassfish server using eclipse and all it took was to use an annotation @WebService to make it a web service. 

package com.javajee.webservices.soap;

[Lab] Deploying a Bottum-up SOAP Web Service in Glassfish Server from Eclipse


Before trying out this example, you will need to download and install Java EE 7 SDK which comes with GlassFish Open Source Edition 4 (currently 4.1.1) and then configure eclipse to deploy Java EE applications directly to GlassFish Server.

For details, refer to http://www.javajee.com/configuring-glassfish-server-4-with-eclipse-to-bu....


Handling Exceptions in Java

We can handle exceptions using the try-catch-finally construct or explicitly tell as being handled elsewhere through the use of throws clause in that method signature.

The try-catch-finally block will look as below:


//Some code that can throw IOException


catch(Exception ex)


//do some workaround.

Java 7 New Exception Features - Multicatch Exceptions and Try with Resources

Java 7 introduces few new features to the exception handling mechanism. We will discuss them quickly here.


Java 7 Multi-Catch Exceptions

With java 7, you can catch multiple exceptions using a single catch block as:

    try {

      File file = new File("filename.txt");

      Scanner sc = new Scanner(file);

      throw new SQLException();


    catch (FileNotFoundException | SQLException e) {

[Approach] Check if a Binary Tree is a Binary Search Tree (BST)


Given a binary tree, find out if it is a binary search tree or not.


Approach 1

  • You can traverse the tree in in-order way, and see if the elements are assending.

    • You may either put the elements into an array and see if the array is sorted in assending way,

Inheritance Strategies in Hibernate 4.3

Hibernate uses following strategies for saving an inheritance hierarchy of classes created in Java to the databases: SINGLE_TABLE, TABLE_PER_CLASS and JOINED.  

We can use @Inheritance annotation over the entity class to specify the inheritance strategy.

We specify the inheritance strategy by assigning a strategy from the InheritanceType enumeration to the strategy parameter of the @Inheritance annotation.  

SOAP and EJB Quick Reference for Java EE 6 Web Services Certification Exam 1z0-897

EJBs can serve as endpoints for SOAP based web services if hosted in a container with runtime and service support. New client applications can then be built using the published WSDL to access existing business logic. New remote clients can also continue to access business logic using RMI. Thus clients will have now a choice to use RMI or web services to access the business logic.

There are primarily four types of EJBs:

  • Stateful session bean

SOAP Message Handlers Quick Reference for Java EE 6 Web Services Certification Exam 1z0-897

SOAP message handlers enable Web Services and clients to perform additional processing on the SOAP message request or response, by intercepting the SOAP message in both the request and response of the Web Service. 


SOAP handlers and logical handlers

  • JAX-WS supports two types of SOAP message handlers:

    • SOAP handlers


Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!