Posts

Showing posts from January, 2009

CXF MTOM DATA BINDING

Image
Upload attachment (document) using CXF ( MTOM ) Spring and Tomcat Incase you have any difficulty in setup please contact us . Let us now create a resume upload web service using Apache CXF, Spring and Tomcat and consume it. The web service will be used to upload an attachment [resume]. The scenario considered here is a candidate uploading his/her resume and the resume [word document] is retrieved and stored on the server. The following files are involved in the demo of the tutorial. Download the files (zip format) Resume.java This DTO (value object) represents the resume of a candidate. ResumeUploadService.java This interface has uploadResume method which accepts a Resume. ResumeUploadServiceImpl.java Implementation class for ResumeUploadService.java Client.java Code which consumes the web service. cxf.xml Informs Spring [which is referenced from CXF] about the related Java classes for a given web service. Before getting into the details of the above files

CXF With Spring

* Set up your build for CXF * Writing a simple JAX-WS service * Set up the HTTP transport This example corresponds to the spring_http example in the CXF distribution. Setting up your build Open up your favorite IDE and create a new project. The first thing we need to do is add the necessary CXF dependencies to the project. You can find these dependencies in the CXF distribution in the lib directory. commons-logging-1.1.jar geronimo-activation_1.1_spec-1.0-M1.jar (or Sun's Activation jar) geronimo-annotation_1.0_spec-1.1.jar (JSR 250) geronimo-javamail_1.4_spec-1.0-M1.jar (or Sun's JavaMail jar) geronimo-servlet_2.5_spec-1.1-M1.jar (or Sun's Servlet jar) geronimo-ws-metadata_2.0_spec-1.1.1.jar (JSR 181) jaxb-api-2.0.jar jaxb-impl-2.0.5.jar jaxws-api-2.0.jar neethi-2.0.jar saaj-api-1.3.jar saaj-impl-1.3.jar stax-api-1.0.1.jar wsdl4j-1.6.1.jar wstx-asl-3.2.1.jar XmlSchema-1.2.jar xml-resolver-1.2.jar The Spring jars: aopalliance-1.0.jar spring-core-2.0.8.jar spring-be

Key Idea

Name : Amila Silva Key: 3696-PAH5A-NCLEQ-ALNOU-RKVMP-9O584

Apache CXF Web Services Tutorial

I created a web service today with CXF and wanted to share the steps it took to get it up and running in this quick tutorial. Apache CXF was created by the merger of the Celtix and XFire projects. , the documentation is still a work in progress. However, do not fret because this CXF tutorial will get you up and running in no time. I will be creating a simple web service that will allow the retrieval of employee information. The service will return this simple POJO (Plain Old Java Object) bean with matching getters and setters: package com.company.auth.bean; import java.io.Serializable; import java.util.Set; public class Employee implements Serializable { private static final long serialVersionUID = 1L; private String gid; private String lastName; private String firstName; private Set privileges; public Employee() {} public Set getPrivileges() { return privileges; } public void setPrivileges(Set privileges) { this.privileges = privileges; } public String getFirstName()