FastInfoset Using CXF

FastInfoset Using CXF explains about How to use FastInfoset encoding with CXF framework

FastInfoset is a binary encoding for an XML Information, It incorporated with a more efficiant serialization mechanism than text based

Using FastInfoset encoding is a much better solution than gzip encoding because FastInfoset optimize both size and performance, while gzip only deals with size

You can also see the GZIP Using CXF if you need to configure gzip compression

You can see the below example, which is demonstrating the usage of FastInfoset Using CXF

FastInfoset Using CXF

I am going to re-use CXF Web Service Tutorial

Following additional jar must be in classpath

  1. FastInfoset-1.2.16.jar (Available on CXF bundle)

For enabling FastInfoset, just change the service interface, For this you need to add the below annotations on service interface class


package com.student;

import javax.jws.WebService;

import org.apache.cxf.annotations.FastInfoset;


public interface ChangeStudentDetails {
Student changeName(Student student);


In order to run the client, you need to add cxf libraries to class path, you can see this on below article

Create CXF Client Example

Run Client

import org.apache.cxf.ext.logging.LoggingInInterceptor;
import org.apache.cxf.ext.logging.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.student.ChangeStudentDetails;
import com.student.Student;

// Invoke CXF client with FastInfoset

public final class StudentClient {

public static void main(String args[]) throws Exception {

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

().add(new LoggingInInterceptor());
().add(new LoggingOutInterceptor());
      ChangeStudentDetails client =
(ChangeStudentDetails) factory.create();
      Student student =
new Student();
      Student changeName = client.changeName
("Server said: " + changeName.getName());

Here you can see that Eclipse console is showing response with content type as content-type=[application/fastinfoset]

FastInfoset Using CXF

Your email address will not be published. Required fields are marked *