tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Kildén <karl.kil...@gmail.com>
Subject All fields null when unmarshal json using jax-rs Client
Date Thu, 03 Nov 2016 16:32:44 GMT
Hi!

I am trying to consume a restful service with TomEE 7 and jax-rs Client. I
copied the DTO between the projects. The other system uses a fairly old
jersey impl and I can't change that for now.

I have this DTO

import javax.xml.bind.annotation.XmlRootElement;


@XmlRootElement
public class HelloWorldDTO {

private String test = "test";

public String getTest() {
return test;
}

public void setTest(String test) {
this.test = test;
}
}

The service I am calling gives this response in the browser when I try the
service that way:

{"helloWorldDTO":{"test":"test"}}

The way I doing the call is:
client.target(builder).request(MediaType.APPLICATION_JSON).get(HelloWorldDTO.class)

The URL is correct and response code is correct etc... I get the
entity but the property test is null but it was sent as "test".


Any tips on how to debug this? Should I try adding a wrapper on any
side? :) I think I did try that but it did not help. In my real use
case I need to send several and I have a wrapper with a List. When it
came across as null I tried just with a simple property and still the
problem persists.

Thankful for advice!


Cheers

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message