jaxrs « jaxb « Java Enterprise Q&A

1. Java REST client without schema    stackoverflow.com


Java client for Yahoo's HotJobs Resumé Search REST API.


I'm used to writing web-service clients for SOAP APIs, where wsimport generates proxy stubs and you're off and running. But ...

2. JAX-RS get entity as JAXB object and as String    stackoverflow.com

I have a JAX-RS web service (using jersey) that accepts a JAXB object as the request entity. When we get an error, we want to log the original xml string that ...

3. Marshall/Unmarshall a JSON to a Java class using JAXB    stackoverflow.com

I am successfully marshaling a POJO into JSON using JAX-RS and JAXB annotations. The problem is that when I am trying to use the same for un-marshalling my request it doesn’t work. ...

4. How can I customize serialization of a list of JAXB objects to JSON?    stackoverflow.com

I'm using Jersey to create a REST web service for a server component. The JAXB-annotated object I want to serialize in a list looks like this:

@XmlRootElement(name = "distribution")
@XmlType(name = "tDistribution", propOrder = ...

5. JAXB marshalling superclass    stackoverflow.com

I am writing a Resteasy server application and am having trouble getting my superclasses to marshal. I have code something like this:

@XmlRootElement(name = "person")
class Person {
  protected String name;


6. unable to find a MessageBodyReader    stackoverflow.com

I have this interface:

public interface InboxQueryResourceTest {

    public MultipartOutput query(@PathParam("membershipExternalId") final ...

7. Custom Response + HTTP status?    stackoverflow.com

I have a rest interface for my project. For one class i have a POST method where you can post an xml and i RETURN a custom response like: <customResponse>Invalid email</customResponse> if the email ...

8. JAX-RS and JAXB_ENCODING    stackoverflow.com

I am using the RestEasy library to do JAX-RS web services. I am not instantiating a JAXBContext in my service methods. Is there a way to make JAX-RS include the "<?xml ...

9. System wide adapter in Jersey?    stackoverflow.com

I'm trying configure a "system wide" custom javax.xml.bind.annotation.adapters.XmlAdapter for the java.util.Locale type in Jersey. It's easy enough to use @XmlJavaTypeAdapter on classes I control but that's not always the case ...

10. Why are names returned with @ in JSON using Jersey    stackoverflow.com

I am using the JAXB that is part of the Jersey JAX-RS. When I request JSON for my output type, all my attribute names start with an asterisk like this, This object;

package ...

11. Is it possible to catch SAXParseException in JAX-RS/JAXB webservice?    stackoverflow.com

I would like to check in a JAX-RS webservice request that valid XML was included in the body. However, this code:

public MyObject updateMyObject(@PathParam("objectID") String existingObjectID, JAXBElement<MyObject> object)

12. How do I set the xml namespace when using Jersey, jaxb & jax-rs    stackoverflow.com

How do I set the xml namespace when using Jersey, jaxb & jax-rs

13. How to customize namespace prefixes on Jersey(JAX-WS)    stackoverflow.com

when serializing my resources on Jersey, I want to use namespaces in some cases. Is there any way to customize the namespace prefixes on jersey? Default:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<order xmlns:ns2="http://www.w3.org/2005/Atom">

14. How can I tell Jersey to use my MessageBodyReader instead using JAXB?    stackoverflow.com

Basically, I have some models which all use JAXB. However, I have some highly custom functionality to convert to JSON and back so I want to write my own MessageBodyReader/Writer to ...

15. JAX RS Jersey Schema Validation    stackoverflow.com

How to configure schema validation for JAX-RS RESTFul services? We are using XSD to define the models, and JAXB to generate the java models.

16. How do you create backwards compatible JAX-RS and JAX-WS APIs?    stackoverflow.com

JAX-RS and JAX-WS are great for producing an API. However, they don't address the concern of backwards compatibility at all. In order to avoid breaking old client when new capabilities are ...

17. Problem with JAXB marshalling an object: javax.xml.bind.JAXBException: class ... or any of its super class is known to this context    stackoverflow.com

In my JAX-RS project (Jersey) I'm having a problem getting one of the JAXB-annotated objects marshalled to JSON. Here is the error message I see in the logs:


18. Memory error with Jersey Jax-RS    stackoverflow.com

I am returning a large amount of data via a rest service. The query returns about 200,000 rows of data then gets converted to XML. When I run this service in ...

19. RESTEasy @WrappedMap    stackoverflow.com

I am using RESTEasy to write a RESTful web service and trying to write a response that contains a HashMap. The web service produces either JSON or XML. The ...

20. JAXB writing to OutputStream inside writeTo method    stackoverflow.com

I have been trying to write a String directly to OutputStream inside the writeTo implementation method of MessageBodyWriter interface. I want to do this inside a try catch block to send ...

21. JAXB minOccurs disappear when required is set to true    stackoverflow.com

I got this from the JAXB doc for @XmlElement

If required() is true, then Javabean property is mapped to an XML schema element declaration with minOccurs="1". maxOccurs ...

22. XMLAdapter for HashMap    stackoverflow.com

I want to convert a list of items inside of my payaload and convert them into a hashmap. Basically, what I have is an Item xml representation which have a list ...

23. JAXB @XmlElements, different types but same name?    stackoverflow.com

I have an Animal class and an extension of Animal called AnimalExtension.

public class Animal

public class AnimalExtension extends Animal
The only difference between the two classes is that AnimalExtension has another instance ...

24. JAXB / Jersey - Feed doesn't show my nested list - Any idea?    stackoverflow.com

it's really frustrating and I've been fighting with this issue for almost 5 hours now... :( I'd expect JAXB/Jersey to embed my list of downloads in the Project's Json Feed... but unfortunately ...

25. Jersey serialize inherited property twice    stackoverflow.com

I have a java bean without any annotations. And I have a class inherited from this bean with JAXB annotations. Jersey (JAX-RS) serialize the second class to JSON. And inherited properties occur ...

26. Validation during Deserialization / Unmarshalling of JSON Request Data in Jersey (JAX-RS / JAXB)    stackoverflow.com

I'm about to develop a RESTful web service by the help of Jersey (JAX-RS). Particularly, one main requirement is that the web service's data exchange format is JSON. Due to the ...

27. Make a collection generic in javax.xml.bind    stackoverflow.com

In a REST server that I've written, I have several collection classes that wrap single items to be returned from my services:

@XmlRootElement(name = "person_collection")
public final class PersonCollection {

28. How to set up a Restlet server with JAXRS and JAXB?    stackoverflow.com

I've been looking all over the internet trying to find an example of how to do this. I simply want to set up a REST server which automatically serializes objects to ...

29. HTTP Basic Authentication in Restlet with a JAXRS Application?    stackoverflow.com

I'm trying to authenticate access to all resources on my server via HTTP Basic authentication. Currently, my setup looks like this when starting the server:

this.component = new Component();
this.server = this.component.getServers().add(Protocol.HTTP, 8118);

JaxRsApplication ...

30. how to map a bean structure to a different schema with jax-rs    stackoverflow.com

I have this bean

class Test {
   boolean someValue;
   List<Field> fields;
I would like to serialize it as

31. How to produce JSON output with Jersey 1.6 using JAXB    stackoverflow.com

public class Todo {
    private String s = "test";

    public String getS() {
        return s;

32. How to unmarshal xml message with bad parent/child model    stackoverflow.com

I am trying to unmarshall a 3rd party xml payload into a class. The problem is that the payload has a parent/child relationship and the root node, the parent and the ...

33. Processing a large file with a web service    stackoverflow.com

I have web service method that is supposed to process a very large file and output several files to the server. However, this web service will just timeout and there will ...

34. Hierarchy in jersey's EntityHolder type    stackoverflow.com

@XmlRootElement(name = "request")
public class InteractionRequest {
    @XmlElement(name = "skill")
    protected String skillName;

@XmlRootElement(name = "request")
public class InteractionChatRequest extends InteractionRequest {

35. Root element name in collections returned by RESTEasy    stackoverflow.com

I'm using JAX-RS via RestEasy in JBoss AS 6. When my JAX-RS resource returns a collection of items (e.g. via a List), RESTEasy always uses the name collection as the root ...

36. XML without root element in JAXB    stackoverflow.com

I was wondering whether there is a way to create an object such that a list of such object does not need a root element. For example, if I wanted to ...

37. Returning Child IDs using JAXRS    stackoverflow.com

I am running into an issue with JAXRS / JAXB including child IDs in JSON results when using @Produces. Below are portions of my code. Since we are using ...

38. Injecting Java Bytecode in XML for harmful purposes    stackoverflow.com

So I have been thinking whether there is a way to send an XML such that the XML contains code in (bytecode) that will be unintentionally executed by the JVM. I ...

39. Jersey - populate java beans from XML string    stackoverflow.com

I have a Jersey client that is successfully calling a REST service and populating the associated Java Beans CustomerType based on this code:

WebResource service = client.resource(SECURE_BASE_URL);.
CustomerType cust = service.path("customer").path("23210")

40. Is there a possibility to hide the "@type" entry when marshalling subclasses to JSON using EclipseLink MOXy (JAXB)?    stackoverflow.com

I'm about to develop a JAX-RS based RESTful web service and I use MOXy (JAXB) in order to automatically generate my web service's JSON responses. Everything is cool, but due to the ...

41. Map serialization in JAX-B producing unwanted XML namespaces and prefixes    stackoverflow.com

Problem: I'm trying to do a simple serialization of a HashMap with JAX-B in a JAX-RS application and running into extra output that I'd like to avoid. The default serialization of the ...

42. Java: Jersey (JAX-RS) and JAXB_FORMATTED_OUTPUT with annotation?    stackoverflow.com

Currently I have my Jersey (JAX-RS) Webservice return an JAXB annotated Object with a simple @Produces("text/xml") in my Webservice method. Unfortunately the output looks rather messy because its not formatted with ...

43. Java JAX-RS web service: adding nodes to JAXB XML result as threads complete    stackoverflow.com

I have programmed a JAX-RS web service with Jersey that queries prices from different websites and gives the result back as XML through JAXB annotated classes. Unfortunately some websites take up ...

44. Why "invalid request" when requesting resource with mime type application/xml in Jersey?    stackoverflow.com

In our application there is a working method that returns a JSON representation of Company. I modified @Produces by adding MediaType.APPLICATION_XML. However, when I set the "Accept" header in ...

45. JBoss RESTeasy JAX-RS JAXB schema validation with Decorator    stackoverflow.com

I am trying to validate all incoming XML files that come over my (contract first) REST interface in an application running inside JBoss AS 7. I have written a @Decorator for ...

46. @XmlJavaTypeAdapter vs. @JsonSerialize [using restEasy/Jersey/Jackson/Mule]    stackoverflow.com

I'm new to all the JAXB/JAX-RS stuff. At work, we are using Mule ESB with its Jersey/Jackson module to accept incoming REST requests. On the client side we're using RestEasy (with ...

47. resteasy, jaxb - Client framework does not return collection of objects    stackoverflow.com

I want to receive a collection of objects using RESTeasy Client Framework, but this is not working I'm getting an exception. If I use REST Client for Firefox extension ...