For problem 2: get codemaid plugin or resharper and reorder your
properties:

Or you could use an xslt to transform your serialization ordering your
properties as you go.

Davy.

Sent from my starfleet datapad.

On 17 janv. 2014, at 09:43, Greg Keogh <[email protected]> wrote:

Is anyone in here using Web API in anger? I'm experimenting with creating
an API that is simple and easy for non .NET clients to use. Controller
methods that return classes serialised as XML contain everything I expect
but...

*PROBLEM 1* : There are xmlsn="" namespaces cluttering up the root node
that I can't get rid of. I tried a few tricks in web searches but it
changes nothing. Anyone know how to get rid of them and get "plain" XML?

My next hurdle is a POST to create a record. The Request below actually
works, but after hours of suffering I overcame two really weird problems to
make it work, otherwise you get the dreaded 500 error:

*PROBLEM-2* : The XML property elements have to be in alphabetical order
(no kidding!!). They are not in order inside the class.

*PROBLEM-3* : Related to No.1, I have to put the tedious namespaces in the
root element.

Greg K

------------------------------------------------------------------------
POST http://raven/authapi/user/create HTTP/1.1
Content-Type: text/xml
Accept: application/xml
Host: raven

<ApiUser xmlns:i="http://www.w3.org/2001/XMLSchema-instance"; xmlns="
http://schemas.datacontract.org/2004/07/RCS.AuthService.RestApi";>
  <Name>max</Name>
  <Password>T0pSecret</Password>
  <SpokenName>Max Headroom</SpokenName>
</ApiUser>

Reply via email to