for a REST PUT service, im trying to use xml as the payload. My question is can I have the whole payload as xml? or should I do something like Data=<mydata>......</mydada>?
basically
<mydata>......</mydada>
or
Data=<mydata>......</mydada>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure you can just set the mediaType to be
application/xmljust as you can for json or plain text. The first example is valid XML, second one is not. So the first one can be done.I am not sure what framework you are using. For example if you plan to use Spring you can take a look at an example here.
The basic idea is that you define the media type to be
application/xml. You can also specicfy a marshaller/unmarshaller (ie. using JAXB) if you want to marshal/unmarshal from a Java bean.