Silverlight 4 & WCF Deseralizing Issue- There was an error deserializing the object of type 'T'. Unexpected end of file -
i have come across large issue having has come light when upgraded silverlight & web projects versions 4 respectively.
since doing this, wcf services failing following error message:
there error deserializing object of type anyboat.admin.userservice.user. unexpected end of file. following elements not closed: lastname, authenticateuserresult, authenticateuserresponse, body, envelope.
the stacktrace is:
@ system.servicemodel.dispatcher.datacontractserializeroperationformatter.deserializeparameterpart(xmldictionaryreader reader, partinfo part, boolean isrequest) @ system.servicemodel.dispatcher.datacontractserializeroperationformatter.deserializebody(xmldictionaryreader reader, messageversion version, string action, messagedescription messagedescription, object[] parameters, boolean isrequest) @ system.servicemodel.dispatcher.operationformatter.deserializebodycontents(message message, object[] parameters, boolean isrequest) @ system.servicemodel.dispatcher.operationformatter.deserializereply(message message, object[] parameters) @ system.servicemodel.dispatcher.proxyoperationruntime.afterreply(proxyrpc& rpc) @ system.servicemodel.channels.servicechannel.handlereply(proxyoperationruntime operation, proxyrpc& rpc) @ system.servicemodel.channels.servicechannel.endcall(string action, object[] outs, iasyncresult result) @ system.servicemodel.clientbase`1.channelbase`1.endinvoke(string methodname, object[] args, iasyncresult result) @ anyboat.admin.userservice.userserviceclient.userserviceclientchannel.endauthenticateuser(iasyncresult result) @ anyboat.admin.userservice.userserviceclient.anyboat.admin.userservice.userservice.endauthenticateuser(iasyncresult result) @ anyboat.admin.userservice.userserviceclient.onendauthenticateuser(iasyncresult result) @ system.servicemodel.clientbase`1.onasynccallcompleted(iasyncresult result)
i put breakpoint in silverlightfaultbehaviour on response message , envelope reponse got back. notice carriage return between *"\r\n"*
"<s:envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">\r\n <s:header>\r\n <a:action s:mustunderstand=\"1\">urn:userservice/authenticateuserresponse</a:action>\r\n <a:relatesto>urn:uuid:07cc1361-c74c-4449-b423-e982d2ac8e05</a:relatesto>\r\n </s:header>\r\n <s:body>\r\n <authenticateuserresponse>\r\n <authenticateuserresult xmlns:d4p1=\"http://schemas.datacontract.org/2004/07/anyboat.web.classes.dataobjects\" xmlns:i=\"http://www.w3.org/2001/xmlschema-instance\">\r\n <d4p1:active>true</d4p1:active>\r\n <d4p1:emailaddress>robbie@robbietapping.com.au</d4p1:emailaddress>\r\n <d4p1:firstname>robbie</d4p1:firstname>\r\n <d4p1:isadministrator i:nil=\"true\" />\r\n <d4p1:lastname>tapping</d4p1:lastname>\r\n <d4p1:password>xxxxxxxxx</d4p1:password>\r\n <d4p1:userid>2</d4p1:userid>\r\n <d4p1:username>robbietapping</d4p1:username>\r\n </authenticateuserresult>\r\n </authenticateuserr esponse>\r\n </s:body>\r\n</s:envelope>"
can tell me if there away around @ all, upgraded vs2010 sp1 has started show itself.
any information or answers greatfully appreciated.
thanks
edit
the code error occurs on is:
public anyboat.admin.userservice.user endauthenticateuser(system.iasyncresult result) { object[] _args = new object[0]; anyboat.admin.userservice.user _result = ((anyboat.admin.userservice.user)(base.endinvoke("authenticateuser", _args, result))); return _result; }
which serialization type use @ services side? i'm pretty sure use custom serialization. "\r\n" problem pretty common , occurs when you're trying deserialize not formed xml received service.
see 2 ways:
- the preferable way. check serializer @ service side. it's obvious service returns xml in wrong format.
- add iclientmessageinspector client , remove special symbols response before deserialization.
Comments
Post a Comment