Archive: ‘Web Applications’ Category

Creating Web services using Apache CXF (Part 4): Testing

16 comments June 11th, 2009

To test this we can follow the same client program which is given in the CXF site.

Just create a simple Java class and execute it.

   1: package com.your.company.service.client;
   2:
   3: import java.util.List;
   4:
   5: import org.apache.cxf.interceptor.LoggingInInterceptor;
   6: import org.apache.cxf.interceptor.LoggingOutInterceptor;
   7: import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
   8:
   9: import com.your.company.service.Product;
  10: import com.your.company.service.ProductService;
  11:
  12: public final class Client {
  13:
  14:     private Client() {
  15:     }
  16:
  17:     public static void main(String args[]) throws Exception {
  18:
  19:         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
  20:
  21:         factory.getInInterceptors().add(new LoggingInInterceptor());
  22:         factory.getOutInterceptors().add(new LoggingOutInterceptor());
  23:         factory.setServiceClass(ProductService.class);
  24:         factory.setAddress("http://localhost:8080/CXFExample/productservice");
  25:         ProductService client = (ProductService) factory.create();
  26:
  27:         List<Product> products = client.getProducts();
  28:         if (products != null && products.size() > 0)
  29:             System.out.println("Product Name : "
  30:                     + products.get(0).getItemName() + ", Price: "
  31:                     + products.get(0).getPrice());
  32:         System.exit(0);
  33:
  34:     }
  35:
  36: }

Other related posts:

1. Creating Web services using Apache CXF (Part 1) : The Basics.

2. Creating Web services using Apache CXF (Part 2) : Development.

3. Creating Web services using Apache CXF (Part 3) : Configuration.

4. Creating Web services using Apache CXF (Part 4): Testing.

Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

Popularity: 15% [?]

Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

Creating Web services using Apache CXF (Part 1) : The Basics.

16 comments June 10th, 2009

As we discussed in the previous post, CXF is the combination of two projects: Celtix developed by IONA and XFire developed by Codehaus working together at the Apache Software Foundation.

If you want an Enterprise support  for CXF then please find the following links.

Open Source FUSE Services Framework – based on CXF

FUSE open source community

FUSE Forums

CXF Developer Advantages

  • If you know Spring then CXF is too easy for you. All its configurations are in a Spring xml file. Internally CXF is reading this Spring XML as its Configuration file.JAX-WS encompasses many different areas:
    • Generating WSDL from Java classes and generating Java classes from WSDL
    • Provider API which allows you to create simple messaging receiving server endpoints
    • Dispatch API which allows you to send raw XML messages to server endpoints
  • CXF implements the JAX-WS APIs which make building web services easy.
  • Aegis Databinding (2.0.x) is a databinding library that makes development of code-first web services incredibly easy.
  • CXF enables the development of RESTful services via annotations using the HTTP Binding.

It has a lot many features more to say. Once you got your project requirements and clear with the approach which you want to follow then please have a look on this feature list. I think you definitely will choose CXF without any doubt. [I am exerting some of the features from its own site]

General
  • High Performance
  • Extensible
  • Intuitive & Easy to Use
Support for Standards
  • JAX-WS, JAX-WSA, JSR-181, and SAAJ
  • SOAP 1.1, 1.2, WS-I Basic Profile, WS-Security, WS-Addressing, WS-RM and WS-Policy
  • WSDL 1.1 and 2.0
  • MTOM
Multiple Transports, Bindings, Data Bindings, and Formats
  • Bindings: SOAP, REST/HTTP
  • Data bindings: JAXB 2.0, Aegis, XMLBeans. (Castor and JiBX will be supported in a later version of CXF)
  • Formats: XML, JSON
  • Transports: HTTP, Servlet, JMS, and Jabber transports
  • Extensibility API allows additional bindings for CXF, enabling additional message format support such as CSV and fixed record length
Flexible Deployment
  • Lightweight containers: deploy services in Tomcat or Spring-based containers
  • JBI integration: deploy as a service engine in a JBI container such as ServiceMix, OpenESB or Petals
  • SCA integration: deploy in an SCA container such as Tuscany
  • J2EE integration: deploy services in J2EE application servers such as Geronimo, JOnAS, JBoss, WebLogic, and WebSphere
  • Standalone Java client/server
Support for Multiple Programming Languages
  • Full support for JAX-WS 2.0 client/server programming model
  • JAX-WS 2.0 synchronous, asynchronous and one-way API’s
  • JAX-WS 2.0 Dynamic Invocation Interface (DII) API
  • Support for wrapped and non-wrapped styles
  • XML messaging API
  • Support for JavaScript and ECMAScript 4 XML (E4X) – both client and server
  • Support for CORBA with Yoko
  • Support for SCA withTuscany
  • Support for JBI with ServiceMix
Code Generation
  • Java to WSDL
  • WSDL to Java
  • XSD to WSDL
  • WSDL to XML
  • WSDL to SOAP
  • WSDL to service

Other related posts:

1. Creating Web services using Apache CXF (Part 1) : The Basics.

2. Creating Web services using Apache CXF (Part 2) : Development.

3. Creating Web services using Apache CXF (Part 3) : Configuration.

4. Creating Web services using Apache CXF (Part 4): Testing.

Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

Popularity: 35% [?]

Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

Apache CXF- An ultimate web service open source framework : Lets start learning…

7 comments June 10th, 2009

Apache CXF is an open source services framework which is a result of the merge between the XFire and Celtix projects. CXF helps us build and develop services using JAX-WS. These services can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA and work over a variety of transports such as HTTP, JMS or JBI.

If you want to know more about XFire and Celtix then please do visit following links.

Codehaus XFire is a next-generation java SOAP framework. Codehaus XFire makes service oriented development approachable through its easy to use API and support for standards. It is also highly performant since it is built on a low memory StAX based model.

Celtix is a web service framework with support for legacy integration. It primarily focuses on providing JAX-WS and WS-* support.

Lets come back to CXF. Some of the main advantages of this framework are,

  • JAX-WS Specification compliance
  • Improved HTTP and JMS Transports
  • Spring XML support
  • RESTful services support
  • Great WS-* support: WS-Addressing, WS-Policy, WS-ReliableMessaging, and WS-Security are all supported
  • Support for JSON
  • SOAP Attachments support
  • Improved APIs and extension points
  • A larger community, which means faster development, and better support

Through this series of posts I would like to go through CXF from bottom to top. Want to go through from basics – development of a sample – deployment – advantages etc.

I would like to do it in TWO Different ways. Code-First and Contract-First.

Code-First Approach

1. Creating Web services using Apache CXF (Part 1) : The Basics.

2. Creating Web services using Apache CXF (Part 2) : Development.

3. Creating Web services using Apache CXF (Part 3) : Configuration.

4. Creating Web services using Apache CXF (Part 4): Testing.

Contract-First Approach [Under preparation]

  1. Creating Web Services using CXF (Contract first Approach) Part 1: Creating XSDs.
  2. Creating Web Services using CXF (Contract first Approach) Part 2 : WSDL Creation.
  3. Creating Web Services using CXF (Contract first Approach) Part 3: Creating Stubs.
  4. Creating Web Services using CXF (Contract first Approach) Part 4 : Writing the Implementation.
  5. Creating Web Services using CXF (Contract first Approach) Part 5 : Configuration and Deployment.
  6. Creating Web Services using CXF (Contract first Approach) Part 6: Testing.
Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

Popularity: 20% [?]

Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

TWO good slide shows about use of Web 2.0 in Enterprise world

No comments January 23rd, 2008

The following two presentations by Enterprise 2.0 Bloggers Scott Gavin and Daniel Siddle are simply great ones. If you have some time to spent then check it once. I am sure it will be helpful to you. These slideshows are very much helpful to know about the extended use of Web 2.0 in our enterprise world. I got these from Mr.Jonathan’s blog.

Meet Charlie’ is a walk through of the web based knowledge and communication tools used by an internet savvy Project Manager. 

[slideshare id=42907&doc=meet-charlie-what-is-enterprise20-29751&w=425]

Daniel Siddle has written ‘Meet Charlotte’ as a response. If ‘Charlie’ is where early adopters are trying to lead Enterprise IT, then ‘Charlotte’ is a brilliant contrast as to where we are now.

[slideshare id=94449&doc=meet-charlotte2698&w=425]

Technorati Tags: ,
Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

Popularity: 1% [?]

Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

'Six' best web frameworks in Java

No comments November 27th, 2007

A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services. The framework aims to alleviate the overhead associated with common activities used in Web development. Here is the list of SIX best web frameworks which we are using in Java. Each one has its own advantages.

1. Java Server Faces – JSF

  • From Sun Microsystems
  • Based on Component Centric approach
  • Best Feature : The most using web framework. Because of its component architecture, the developer doesn’t need to mess with writing HTML, JavaScript etc to get rich “AJAX” type of functionality. It also takes care of state and event management. It has very less configuration too.

JavaServer Faces (JSF) is a new standard Java framework for building Web applications. It simplifies development by providing a component-centric approach to developing Java Web user interfaces. JavaServer Faces also appeals to a diverse audience of Java/Web developers. “Corporate developers” and Web designers will find that JSF development can be as simple as dragging and dropping user interface (UI) components onto a page, while “systems developers” will find that the rich and robust JSF API offers them unsurpassed power and programming flexibility. JSF also ensures that applications are well designed with greater maintainability by integrating the well established Model-View-Controller (MVC) design pattern into it’s architecture. Finally, since JSF is a Java standard developed through Java Community Process (JCP), development tools vendors are fully empowered to provide easy to use, visual, and productive develop environments for JavaServer Faces.

2. GWT

  • From Google
  • Based on Widgets
  • Best Feature : Speed development. Easy to develop good, neat and “Browser independent” Ajax applications. Give more stress to pure browser independent ;) .

Google Web Toolkit (GWT) is an open source Java software development framework that makes writing AJAX applications like Google Maps and Gmail easy for developers who don’t speak browser quirks as a second language. Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatibilities between web browsers and platforms, and JavaScript’s lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile.GWT lets you avoid many of these headaches while offering your users the same dynamic, standards-compliant experience. You write your front end in the Java programming language, and the GWT compiler converts your Java classes to browser-compliant JavaScript and HTML.Project Home and More features

3. Stripes

  • From Mc4j
  • Based on MVC architecture
  • Best Feature: No Configurations ) . Annotation based programming makes coding more interesting and easy.

Stripes is a presentation framework for building web applications using the latest Java technologies. The main driver behind Stripes is that web application development in Java is just too much work! It seems like every existing framework requires gobs of configuration.Project Home and more features

4. Spring MVC

  • From SpringSource
  • Based on MVC architecture
  • Best Feature : Speed development. Now so many Annotations are also included (v2.5). Its from SpringSource and have a good support too. Being a person who likes and works with Spring framework.. I really encouraged by their good and really fast support.

Spring Web MVC is the own web framework of Spring Framework.The Spring MVC Framework’s architecture and design are in such a way that every piece of logic and functionality is highly configurable. Also Spring can integrate effortlessly with other popular Web Frameworks like Struts, WebWork, Java Server Faces and Tapestry. It means that you can even instruct Spring to use any one of the Web Frameworks. More than that Spring is not tightly coupled with Servlets or Jsp to render the View to the Clients. Integration with other View technologies like Velocity, Freemarker, Excel or Pdf is also possible

5. Struts2

  • From Apache
  • Based on MVC architecture
  • Best Feature : No more ActionForms! Use any JavaBean to capture form input or put properties directly on an Action class. Use both binary and String properties! and its enhanced and rich tags

Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applications. The framework is designed to streamline the full development cycle, from building, to deploying, to maintaining applications over time.Project Home and More Features

6. Wicket

  • From Apache
  • Based on Component Centric approach
  • Best Feature : Swing-like OO Component Model. This feature separates Wicket from all other frameworks

With proper mark-up/logic separation, a POJO data model, and a refreshing lack of XML, Apache Wicket makes developing web-apps simple and enjoyable again. Swap the boilerplate, complex debugging and brittle code for powerful, reusable components written with plain Java and HTML.Project Home and More Features here…

Please put your Suggestions and Ratings here and the frameworks which you are used and known as great ones. That will be more helpful to all of us to get the real idea. As we all know the selection is entirely related with the requirement, learning time and the using situation, this post is gives you an idea about the frameworks using nowadays. Its not at all easy to “rate” the Java frameworks and here I am putting this as per my knowledge and the current trends only. I expect your positive and negative suggestions through valuable comments. All the SIX frameworks noted here are excellent ones and do NOT consider the order as a RANK given to them.

Technorati Tags: , , , , , , , ,

Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

Popularity: 4% [?]

Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This