c# - HttpClient ReadAsAsync only deserializing part of the response -
c# - HttpClient ReadAsAsync<Type> only deserializing part of the response -
i using next create phone call webapi
using (httpclient client = httpclientfactory.create(new authorisationhandler())) { client.baseaddress = new uri(baseuri); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new system.net.http.headers.mediatypewithqualityheadervalue("application/xml")); var httpresponsemessage = await client.postasxmlasync<availrequest>("avail/search/", req); httpresponsemessage.ensuresuccessstatuscode(); var availresp = await httpresponsemessage.content.readasasync<availresponse>(); homecoming availresp; }
the availresponse class looks this
[datacontract(namespace = "")] public class availresponse { [datamember] public icollection<notworkingtype> notworking { get; set; } [datamember] public icollection<workingtype> working { get; set; } }
for reason - unknown me - when response comes in , parsed availresponse
object workingtype
de-serialised , other notworking
1 not. have used fiddler , can confirm response has both these in i. have tried using xmlmediatypeformatter
in place of default , setting usexmlserialiser
true, no avail. shed lite on going on please have thought if not going deserialise chuck , error rather deserialising part of response.
any help ever much appreciated
thanks
nat
c# asp.net-web-api xml-deserialization dotnet-httpclient mediatypeformatter
Comments
Post a Comment