我有以下try
块,我期待来自exchange
的{{1}}方法的回复:
RestTemplate
我期待类型try{
response = restOperations.exchange("http://localhost:8080/midpoint/ws/rest/users/00000000-0000-0000-0000-000000000002",
HttpMethod.GET,
new HttpEntity<String>(createHeaders("administrator", "5ecr3t")),
UserType.class);
logger.info(response.getBody());
}
的响应,请求正确执行,状态为200 OK,但UserType
模型的所有字段都为空,因此我从REST调用未被绑定(映射)。
UserType
的必填字段标注为:
UserType
服务器响应的一个示例:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UserType", propOrder = {
"fullName",
"givenName",
"familyName",
"additionalNames",
"locality",
"assignment",
"activation",
"specialWithInternalizedName",
"singleActivation",
"multiActivation",
"multiActivationCopy",
"singleConstruction",
"multiConstruction",
"multiConstructionCopy"
})
答案 0 :(得分:0)
我解决了在jackson
文件中添加pom.xml
依赖项的问题:
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>