asp.net web api - Webapi put parameter from body requires xml to contain xmlns -


i'm hoping easy question. haven't made public api using webapi or restful service before. have noticed when creating put or post method use complex object parameter xml sent in body required contain namespace info. example.

  public httpresponsemessage put(guid vendortoken, [frombody] actionmessage message)     {         if (message == null)             return request.createerrorresponse(httpstatuscode.expectationfailed,                                                "actionmessage must provided in request body.");          return request.createresponse(httpstatuscode.ok);     } 

for message come not null request has this.

<actionmessage         xmlns:i="http://www.w3.org/2001/xmlschema-instance"         xmlns="http://schemas.datacontract.org/2004/07/integrationmodels">     <message i:type="newagreement">         <agreementguid>3133b145-0571-477e-a87d-32f165187783</agreementguid>         <paymentmethod>cash</paymentmethod>     </message>     <status>0</status> </actionmessage> 

the key here of course xmlns. on 1 hand namespace pretty generic feel shouldn't issue vendors provide, on other hand should need to? if not how can fix message come populated if leave name space out?

ah if make them use json :(

the namespace significant in xml. if want remove it, can change actionmessage class, annotate appropriate attribute (in case, i'm assuming [datacontract(namespace="")]), , should remove need namespace in input (actually, after making change using namespace error, please consider implications if have clients using api out there).


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -