我正在用java创建一个rest服务,现在我正在构建post方法,其中有两个参数必须在postman中输入为xml(用于测试),并在java中获取xml响应并将其插入数据库。
首先,我试图将这些值添加为postman中带有键和值的查询参数。响应是200,但xml是cui=null mesaj=null
这两个值都是空的,即使我在postman中为这两个键添加了值。
它如何看待价值观?这是Java代码:
@Stateless
@Path("/cererepost")
public class HelloWorldResource {
Resp x = new Resp();
@EJB
private NameStorageBean nameStorage;
/**
* Retrieves representation of an instance of helloworld.HelloWorldResource
* @return an instance of java.lang.String
*/
@POST
@Produces("application/xml")
@Consumes(MediaType.APPLICATION_XML)
public Response postMsg(@PathParam("cui") String cui, @PathParam("mesaj") String mesaj) {
String xmlString = "CUI=" + cui + " Mesaj=" + mesaj;
Response response = Response.status(200).type(MediaType.TEXT_XML).entity(xmlString).build();
return response;
}
}
我应该修改什么以便可以看到postman正在生成的xml中我在post中发送的参数值?
提前谢谢