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

  • Home
  • SEARCH
  • 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 7633225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:49:27+00:00 2026-05-31T06:49:27+00:00

I have a service layer that I would like to convert into a webservice.

  • 0

I have a service layer that I would like to convert into a webservice. However I hate using annotations because they severely limit code reusability in my common base classes. Some webservices use a subset of the objects, and I don’t want things exposed for one service to be exposed for another.

I had the same issue with hibernate, however the hbm xml mappings allow me to share the same domain objects and have different mappings for different services, which works great. Is there any kind of rest webservice framework for java that will allow me to describe my api and scheme objects with xml, and still gain the benefits of converting these objects to json/xml etc?

  • 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-05-31T06:49:28+00:00Added an answer on May 31, 2026 at 6:49 am

    Note: I’m the EclipseLink JAXB (MOXy) lead and a member of the JAXB 2 (JSR-222) expert group.

    EclipseLink JAXB (MOXy) has an extension that allows you to represent the metadata as an XML file. You can leverage this metadata in a JAX-RS environment using a ContextResolver:

    package blog.bindingfile.jaxrs;
    
    import java.io.*;
    import java.util.*;
    
    import javax.ws.rs.Produces;
    import javax.ws.rs.ext.*;
    import javax.xml.bind.*;
    
    import org.eclipse.persistence.jaxb.JAXBContextFactory;
    
    import blog.bindingfile.Customer;
    
    @Provider
    @Produces({"application/xml", "application/json"})
    public class CustomerContextResolver implements ContextResolver<JAXBContext> {
    
        private JAXBContext jc;
    
        public CustomerContextResolver() {
            Map<String, Object> props = new HashMap<String, Object>(1);
            props.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY, "blog/bindingfile/binding.xml");
            jc = JAXBContext.newInstance(new Class[] {Customer.class} , props);
        }
    
        public JAXBContext getContext(Class<?> clazz) {
            if(Customer.class == clazz) {
                return jc;
            }
            return null;
        }
    
    }
    

    For More Information

    • http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html
    • http://blog.bdoughan.com/2011/04/moxys-xml-metadata-in-jax-rs-service.html
    • http://blog.bdoughan.com/2011/09/mapping-objects-to-multiple-xml-schemas.html
    • http://blog.bdoughan.com/2012/02/glassfish-312-is-full-of-moxy.html

    Related Stack Overflow Questions

    • Configuring CXF with Spring to use MOXY for XML marshalling/unmarshalling
    • Cannot unmarshal a JSON array of objects using Jersey Client
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a service-layer Interface that extends from a base Interface; I would like
I have Action Helper that is database abstraction layer. I would like to access
I currently have service classes that look something like this public class UserService :
My application I have an application design that looks like this: web application layer
I have a service layer that retrieves a DTO from a repository. Depending on
In my service facade layer, I have a service class with a method/operation that
I have this sort of format asp.net MVC View -> Service Layer -> Repository.
For background, I have a Data layer and Service layer loosely based on Rob
I have a service, business and data access layer. In which layer should I
We have a service that has some settings that are supported only over net.tcp.

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.