使用Jersey在Java中使用RESTWeb服务

使用Jersey在Java中使用RESTWeb服务,java,rest,jersey,Java,Rest,Jersey,我想做的是使用3M Healthcare Data Dictionary Access的web service API将一种医学编码语言中的医学术语(即主动脉瘤)翻译成另一种,使用3M HDD映射并匹配两种不同的语言 我对REST和Jersey非常陌生,到目前为止,我已经使用NetBeans在Tomcat服务器上打印了“Hello World” 听起来很简单,但我只需要轻轻一推就可以踏上这扇门 以下是我在getgo中一直在努力解决的一些问题:(向http添加了另一个t,因为我没有访问权限) h

我想做的是使用3M Healthcare Data Dictionary Access的web service API将一种医学编码语言中的医学术语(即主动脉瘤)翻译成另一种,使用3M HDD映射并匹配两种不同的语言

我对REST和Jersey非常陌生,到目前为止,我已经使用NetBeans在Tomcat服务器上打印了“Hello World”

听起来很简单,但我只需要轻轻一推就可以踏上这扇门


以下是我在getgo中一直在努力解决的一些问题:(向http添加了另一个t,因为我没有访问权限)


htttp://host:port/api/cts/vb/getSupportedCodeSystems 我认为它应该适合你:

@Path("/lookupDesignations") // or you complete path
@GET
@Produces(value = MediaType.APPLICATION_XML)
public Response getLookupDesignation(@QueryParam("codeSystemUid") String codeSystemUid, @QueryParam("conceptCode") String conceptCode) {
     // now you have codeSystemUid and conceptCode as String
     // create you entity or list for you entity to return as XML
     return Response.ok().entity(yourEntity).build();
}
您可以使用模拟服务的REST操作

示例:…/lookupDesignations?codeSystemUid=111&conceptCode=java

您还可以在URL路径中检索变量,如:

@Path("/lookupDesignations/{codeSystemUid}/{conceptCode}") // or you complete path
@GET
@Produces(value = MediaType.APPLICATION_XML)
public Response getLookupDesignation(@PathParam("codeSystemUid") String codeSystemUid, @PathParam("conceptCode") String conceptCode) {
     // now you have codeSystemUid and conceptCode as String
     // create you entity or list for you entity to return as XML
     return Response.ok().entity(yourEntity).build();
}
在本例中,您可以调用URL:…/lookupDesignations/111/java

我希望这对你有用


如果我误解了你的问题,请告诉我

关于如何使用参数进行请求,您看过任何Jersey(-ish)示例应用程序吗?谢谢您的输入Deividi。这意味着什么htttp://localhost:port/api/cts/vb/lookupDesignations/2.16.840.1.113883.3.232.99.5/AANS 应该在我的浏览器上工作吗?例如,假设2.16.840.1.113883.3.232.99.5是codeSystem_Id,AANS是表示医学术语“主动脉瘤”的概念代码。是的,它会起作用。有了这个URL,我认为使用codeSystemUid作为最后一个参数应该更“漂亮”。但结果是一样的。为什么对我不起作用?它说“找不到请求的资源抱歉,我们找不到您要查找的资源”。发生此错误的原因是您对应用程序中未映射的某个URL进行了http调用。您是否仔细检查了Jersey的web.xml配置以及类/方法中的@Path注释?你能更新你的问题并把你的代码给我看看吗?