我正在尝试通过代理调用 Web 服务方法,但我收到一条错误消息:“目标类的子资源没有 jax-rs 注释。:org.jboss.resteasy.core.ServerResponse”
这是我的服务器类
@Path("/authorizationCheck")
public class AuthorizationRestService implements AuthorizationService {
@Override
@Path("/webserviceTest")
public Response webserviceTest(){
TestDTO x = new TestDTO();
x.setFieldOne("ffff");
x.setFieldTwo("gggg");
Response res = Response.ok(x).build();
return res;
}
}
有这样的界面
@Path("/authorizationCheck")
public interface AuthorizationService {
@POST
@Path("/webserviceTest")
public Response webserviceTest();
}
我的返回对象包含在响应中
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class TestDTO {
private String fieldOne;
private String fieldTwo;
public String getFieldOne() {
return fieldOne;
}
public void setFieldOne(String fieldOne) {
this.fieldOne = fieldOne;
}
public String getFieldTwo() {
return fieldTwo;
}
public void setFieldTwo(String fieldTwo) {
this.fieldTwo = fieldTwo;
}
}
最后是我的客户班
@Stateful
@Scope(ScopeType.CONVERSATION)
@Name("authorizationCheckService")
public class AuthorizationCheckService {
public void testWebservice(){
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
AuthorizationService proxy =
ProxyFactory.create(AuthorizationService.class,
ApplicationConfig.WORKFLOWSERVER_URL + "services/authorizationCheck/webserviceTest");
Response response = proxy.webserviceTest();
return;
}
}
我在这里做错了什么,任何帮助将不胜感激。