Posts

Showing posts from August, 2012

cxf-jaxws-SOAP Example-Live Resturant Example

This is a simple cxf-jaxws application.The appliction offers 2 services
cancel orderplace order The wsdl can be accessed at: http://localhost:8086/cxf-jaxws-LiveResturant/OrderService?wsdl
CXF webservice depends on the service endpoint interface.
Uses spring based configuration.
The application has been tested on tomcat and uses the latest cxf jar files.
Create a web application project in eclipsecxf.xml -add a cxf.xml in web-inf folder <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:wsa="http://cxf.apache.org/ws/addressing" xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager" xmlns:wsp="http://www.w3.org/2006/07/ws-policy" xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata" xmlns:mt…

Code First Webservice using jax-ws and CXF- webservice framework

Create a BeanCreate a SEI-Service End Point InterfaceUse Annotation on the SEI @ webserviceCreate a Implementation Class which implements the SEICreate a CXF.xml file add the  SEI and impl mapping in the xml fileconfigure the cxf file in the web.xmlmap the  spring context listener and cxf servlet in the web.xml.

What are the Front ends Provided by Apache CXF

JAX-WSJAX-RSSimpleJavaScript

What is Bindings in Webservice and types of Bindings

Bindings:Maps a webservice message to the protocol.

Types of Bindings:

SOAP bindings:Maps a webservice message to a SOAP service
Pure XML Bindings:sends a raw xml message
HTTP Bindings:Maps webservice message using a RESTFUL service.

Creating threadpool to execute tasks

The below code shows  usage of  util.concourrent.ExecutorService to create a thread pool.
The tasks are executed concurrently using the avilable number of fixed threads.
Below link tells us the difference of thread vs runnable interface


3) Runnable interface represent a Task which can be executed by either plain Thread or Executors or any other means. so logical separation of Task asRunnable than Thread is good design decision.
Read more: http://javarevisited.blogspot.com/2012/01/difference-thread-vs-runnable-interface.html#ixzz22rz8RZqi



package com.anjana.threadpools; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.anjana.dao.TenantManager; public class Main { private static final int NTHREDS = 4; public static void main(String[] args) { ExecutorService executor = Executors.newFixedThreadPool(NTHREDS); TenantManager tm=new Tenan…