Posts

Publishing Simple Java class as Web Service using Axis

Image
In Previous post on Axis ( http://ydtech.blogspot.com/2009/06/deploying-apache-axis-to-oracle-oc4j.html ), I have explained how to deploy Axis as a Web Application. Now its time to utilize Axis web service framework. Apache Axis provides a very simple way of publishing any simple java class as Web Service. This post explains it in simple steps. 1. Code your service implementation as a Simple java class. For this example we take example of simple String Conversation Service( lower case to upper case). This is only for demo purpose. Now Our pojo java class would be public class StrConvService {     public StrConvService() {     }     public String invoke(String str){         return str.toUpperCase();     } } 2. Name this file as StrConvService.jws and copy it to <OC4J_Home>/jdev/home/application/<Axis_WebApp_Home>/<webapp> ...

Deploying Apache Axis to Oracle OC4J Application Server

Image
            Apache Axis is a framework processing SOAP message. It gives a very flexible ways of handling SOAP message. It provides very convenient  ways of creating and invoking web services. You can leave overhead of handling SOAP message to axis framework.  Axis is installed as Web Module in any application server, this web module will acts as wrapper Web Service for your simple pojo java classes. Any simple java class will get converted to web service using this Axis Web module. This tutorial explain deploying Axis to OC4j application server. 1. First download Axis archive from http://people.apache.org/dist/axis/nightly/ . 2. Extract the zip file. 3. to deploy Axis as Web App to OC4j , we need to create archive file (war) and then deploy through console. So to create a war file go to command prompt and go to <asxis_home>/webapps/axis/ 4. execute the command    jar –cvf axis-webapp.war ....

HTTP 1.0 to HTTP 1.1

A major improvement in the HTTP 1.1 standard is persistent connections. In HTTP 1.0, a connection between a Web client and server is closed after a single request/response cycle. In HTTP 1.1, a connection is kept alive and reused for multiple requests. Persistent connections reduce communication lag perceptibly, because the client doesn't need to renegotiate the TCP connection after each request.

REST vs SOAP based Web Services

Another Web service approach is getting popular i.e. REST based services. REST stands for Representational State Transfer. Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. In REST-full web services, the emphasis is on simple point-to-point communication over HTTP using plain old XML(POX). But architects and developers need to decide when this particular style is an appropriate choice for their applications. A RESTFul design may be appropriate when The web services are completely stateless. A caching infrastructure can be leveraged for performance. If the data that the web service returns is not dynamically generated and can be cached, then the caching infrastructure that web servers and other intermediaries inherently provide can be leveraged to improve performance. However, the developer must take care because such caches are limited to the HTTP GETmethod for most servers. The service produc...

First Hand on JCS

Java Caching system (JCS) is open source java based caching system. JCS is useful for high read , low put application. The base of JCS is the Composite Cache, which is the pluggable controller for a cache region. There are fews terms relatated to JCS such as Element, Region, Auxiliaries etc  JCS is an object cache, exactly like putting object in hashtables. These objects are nothing but elements and each hashtable is Cache Region and customisable plugins to region are Auxiliaries.  You can read more about JCS at   http://jakarta.apache.org/jcs/index.html . This tutorial gives simple steps to get JCS working. 1. Download JCS from  http://jakarta.apache.org/jcs/DownloadPage.html 2. JCS needs two more jar files  1. common-logging.jar You will get this jar from apache tomcat installtion 2. concurrent.jar  You will get required java source code at  http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html. Once you download source c...

Working with Java Reflection

Java reflection gives flexibility of controlling java application's behavior runtime. This tutorial explains using java reflection to load, instantiate and access member dynamically. Some simple and straight forward steps to use reflection are 1. Load class and get reference to Class Object [ using default class loader or custom one ]get required class properties using Class Object such as constructor, methods, fields etc 2. Instantiate class either using specific constructor or default one. 3. Invoke methods using object reference. Here , class MyCar is being accessed using reflection by TestRefelction class. MyCar package reflectionproject; public class MyCar { /** * private memebrs */ private String modelName; private String color; public static String parkingSlot; /** * default constructor */ public MyCar() { } public MyCar(String modelName, String col...

JAXB By Example

Java Architecture for XML Binding makes developer's life easier .Extended markup language (XML) is standard for exchanging data in between different applications across the network and Java provides a platform for building portable applications . JAXB API provides easier and standard way of accessing XML in java application. It is just two steps process Bind the Schema , binding xml schema to set of Java classes Unsharshaling / marshaling , XML to Java or Java to XML Following are step by step processing of using JAXB 1. Sample department XML Schema, save in the file named dept.xsd. Put in current directory. 2. Generate Java Classes from XML Schema using xjc tool xjc –d src/ dept.xsd output of this command : parsing a schema... compiling a schema... demo\jaxb\Customer.java demo\jaxb\Item.java demo\jaxb\Items.java demo\jaxb\ObjectFactory.java demo\jaxb\Order.java demo\jaxb\package-info.java demo\jaxb\package-info.java As you see the output, it will create j...