I am currently using xmlhttp send to PUT something back onto the webservice:
My XML :
<collection>
<beanRepresentation>
<beanRepId>1323</beanRepId>
<beanRepName>john</beanRepName>
</beanRepresentation>
...more <beanRepresentations> ..
</collection>
I pull this XML, make some changes using through my HTML page. And now I want to use PUT
to update the changes I made to beanRepresenetation.
I do not want to update the whole XML, just the single object I made changes in. I am doing it like the following:
xmlhttp.open("PUT","http://localhost:8080/rest/beanRepresentation",
false);
xmlhttp.setRequestHeader("Content-type","application/xml");
xmlhttp.send((xmlDoc.getElementsByTagName("beanRepresentation")[0]));
firebug says:
PUT http://localhost:8080/rest/beanRepresentation 400 Bad Request
and the Source shows this is what I am sending:
[object Element]
This is the problem, why aren't I sending this back:
<collection>
<beanRepresentation>
<beanRepId>1323</beanRepId>
<beanRepName>Updated Name</beanRepName>
</beanRepresentation>
</collection>
?? I need it to PUT it back like the above format, not " [Object Element]
".
弄清楚了:
xmlhttp.send((new XMLSerializer()).serializeToString(xmlDoc.getElementsByTagName("beanRepresentation")[i]));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.