Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7764089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:49:22+00:00 2026-06-01T14:49:22+00:00

I am working with sample REST service with Apache CXF, But somehow I am

  • 0

I am working with sample REST service with Apache CXF, But somehow I am not able to call the service. My implementation class is,

package com.ananth.lab.cfxrest.service;

import com.ananth.lab.cfxrest.vo.Address;
import com.ananth.lab.cfxrest.vo.Employee;
import org.springframework.stereotype.Service;

import javax.jws.WebService;
import javax.ws.rs.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;


@Path("/cservice")
@Produces("application/xml")
public class EmployeeService {

    @GET
    @Path("/emp")

    public Employee getEmployee() {

        Address address1 = new Address();
        address1.setCity("Chennai");
        address1.setZip(63);
        List<Address> list = new ArrayList<Address>();
        Address address2 = new Address();
        address2.setCity("Bangalore");
        address2.setZip(49);
        list.add(address1);
        list.add(address2);
        Employee emp = new Employee();
        emp.setAddress(list);
        emp.setEmployeeId("001");
        emp.setEmployeeName("Ananth");

        return emp;
    }
}

My web.xml file is,

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Hello world REST service with apache cxf</display-name>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>WEB-INF/beans.xml,WEB-INF/applicationContext.xml</param-value>
    </context-param>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <servlet>
        <servlet-name>CXFServlet</servlet-name>
        <display-name>CXF Servlet</display-name>
        <servlet-class>
            org.apache.cxf.transport.servlet.CXFServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

</web-app>

I deployed in Tomcat and the context path is “Lab”. So I am trying to access the service like:

http://localhost:8080/Lab/cservice/emp

I am getting

No service was found.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:49:23+00:00Added an answer on June 1, 2026 at 2:49 pm

    I think you should make sure that your Employee class have a correctly “@” remark. just like below:

    @XmlRootElement(name="cservice")
    
    public class Employee (){
        private String employeeId;
        private String employeeName;
        ...
    
    
    @XmlElement(name="employeeId")
        public void setEmployeeId(String employeeId){
            ...
        }
        public String getEmployeeId(){
            return this.employeeId;
        }
    
    @XmlElement(name="employeeName")
        public void setEmployeeName(String employeeId){
            ...
        }
        public String getEmployeeName(){
            return this.employeeName
        }
    ...
    ...
    }
    

    and I suggest you to check WEB-INF/beans.xml & WEB-INF/applicationContext.xml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a sample i found on this site: http://kevinmusselman.com/blog/2009/02/access-webcam-with-flash/ it captures the
I am working with the sample Home application project on http://developer.android.com/resources/samples/Home/index.html I've added another
I'm working with Redmine's xml rest api. The service returns xml like in the
I have a simple WCF4 REST service which is working fine when using a
I have created a REST Web Service that in all other ways is working
I'm working on making a client for my REST service on the iPhone. I'm
I have been working on setting up a WCF REST service in .NET 4.0.
Can someone explain the statement below to me with a working sample/example. thanks in
I'm working on sample webapp that I'm supposed to show to my CTO. It's
I am working on a sample map kit app for iOS. I have everything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.