heartin's blog

SOA and SOAP Based Web Services

Introduction to SOA

Wikipedia defines SOA as "Service-oriented architecture (SOA) is a software design and software architecture design pattern based on discrete pieces of software providing application functionality as services to other applications. This is known as Service-orientation. It is independent of any vendor, product or technology.".


Overview of Top-down and Bottom-up SOAP Web Service Development

Web services can be created using two ways: top-down development and bottom-up development.


Top-down web services development

  • Top-down Web services development involves creating a WSDL and then creating the Web service using the WSDL file. 

    • In top-down approach, first you design the implementation of the Web service by creating a WSDL file. You can then create the Web service skeleton Java classes from the wsdl, and add the required code. 

Object States in Hibernate 4.3

 A java object within a hibernate application can be in one of the three states:

  1. New/transient

  2. Attached/persistent

  3. Detached


Important points about object states in Hibernate

  • When an object is created, it will be in the new/transient state.

    • Hibernate will not save any updates to the transient objects.

Using DOM, SAX and StaX APIs for XML processing

Document Object Model (DOM), Simple API for XML (SAX) and Streaming API for XML (StAX) are populat APIs for processing XML documents.


Document Object Model (DOM)

  1. The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML, and XML documents.


JAX-WS is mainly used for working with SOAP based web services and SOAP based web services are primarily based on XML: SOAP message (which is the format for message exchange in SOAP web services ) itself is XML and WSDL (which is the description of a SOAP web service) is also XML based. So we will discuss few important points about JAX-WS and XML.

Introduction to XSD

XSD (XML Schema Definition), a recommendation of the World Wide Web Consortium (W3C), specifies how to formally describe the elements in an Extensible Markup Language (XML) document.

XSD can be used by programmers to verify each piece of item content in a document. They can check if it adheres to the description of the element it is placed in.



<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

Introduction to XML

Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable



<?xml version="1.0" encoding="UTF-8"?>


Dynamic Lock-ordering Deadlock Solution

We have seen a dynamic lock ordering deadlock example previously.

Simple Lock Ordering DeadLock Example

Let us consider an example program that deadlocks, and then see how we could have avoided that. Below example is an example for a lock ordering deadlock.

The DeadLockExample class has two objects lockObject1 and lockObject2, which we will use as locks for synchronizing.

We will have two Runnables, which we will use for creating two threads: Runnable1 synchronizes on lockObject1 and try to get lockObject2, and Runnable2 synchronizes on lockObject2 and try to get lockObject1.

[Problem] Printing Even and Odd using Two Threads with Coordination


Create two threads - one that prints odd numbers till 10 in the format "Odd 1", "Odd 3" etc. and one that prints even numbers till 10 in the format "Even 0", "Even 2" etc..

Need to implement coordination between them so that the output will be:













Search the Web

Custom Search

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