【发布时间】:2019-09-03 10:15:53
【问题描述】:
我已配置如下 Web 服务端点。
@POST
@Consumes({MediaType.APPLICATION_XML})
@Produces({MediaType.TEXT_PLAIN})
@Path("/post")
public String postPerson(Person pers) throws Exception{
String xml_string_posted="?";
System.out.println(<xml_string_posted>);
JAXBContext jc = JAXBContext.newInstance(Person.class);
XMLInputFactory xif = XMLInputFactory.newFactory();
XMLStreamReader xsr = xif.createXMLStreamReader(new StreamSource());
}
我的问题很简单。每当有 POST 请求提交到这个端点,如下所示,我怎样才能将下面发布的整个 XML 字符串放入一个变量中。
POST /JX-1.0/service/person/post HTTP/1.1
Host:
Content-Type: application/xml
X-Requested-With: XMLHttpRequest
<?xml version="1.0"?>
<a>
<b>&name;</b>
</a>
【问题讨论】: