2
votes

I have a customer table which consists of almost a 50++ fields. I was just thinking if would it be feasible if I pass these through a XML formatted text since their are a lot of parameters

Sample Below:

[OperationContract] [WebInvoke(UriTemplate = "new/customerxml/", Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat= WebMessageFormat.Xml)] public XmlElement NewCustomer(XmlElement value)

Do i pass the XmlElement this way?

3
Are you querying data (from the server), or sending data (to the server)?Marc Gravell

3 Answers

1
votes

Yes, you can send XML when calling a REST webservice, but you have to use the POST method instead of GET.

1
votes

The way in which you pass data is completely up to you. You are free to use your own, proprietary binary format if you are so inclined. Not many clients may know what to do with that, but if you are using your own client code...

It would be good to define a content type and use that. Maybe use ordinary application/xml for clients that don't know your proprietary format and application/foobar for your own special 'foobar' content type.

0
votes

Yes, go for it! Or use JSON, or YAML, or TAB-delimited text, or whatever strikes your fancy.