我使用RestFul Webservice
与JBoss Server
部署的应用接收JSONObject
我web service
,来测试我创建了web service
和笔试情况下它。现在我得到了传递JSONobject
挂了从测试用例到Web服务,当我将json对象传递给@post service
时,调用它的响应即为Null Pointer Exception
,即使我尝试将字符串传递给它,它也会响应null
值。 我用Annotations
为webservice
在RESTful Web服务传递的JSONObject
@consumes({Mediatype.APPLICATION_JSON})
@Consumes("application/json")
测试情况如下由于:
@Test
public void testgetmsg() {
String msg = "{\"patient\":[{\"id\":\"6\",\"title\":\"Test\"}]}";
try {
JSONObject obj = new JSONObject(new JSONTokener(msg));
WebResource resource = client.resource("https://localhost:8443/../../resources/create");
ClientResponse response = resource.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).
entity(obj).post(ClientResponse.class,JSONObject.class);
}
}
任何机构可以引导我继续办理?
由于提前