Wednesday, December 19, 2007

XmlSerializer error while accessing an object from web service in InfoPath browser from.

Problem:

This error is happened while accessing an class (accessing the object) from web service with in a InfoPath browser from. This will work fine within Win from but with browse from hitting error. Stack trace of error as follows:

There is an error in XML document (1, 268). ---> System.Security.SecurityException: Request failed. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderNDAWebService.Read5_NDA(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderNDAWebService.Read14_GetNDADataResponse() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer17.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) The action that failed was: Demand The type of the first permission that failed was: System.Security.PermissionSet --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at Amendment.NDA_SP.NDAWebService.GetNDAData(String NDASerialNumber) at Amendment.FormCode.FormEvents_Loading(Object sender, LoadingEventArgs e)

Solution:

Set Full trust to the form with Digital Certificate.

Tools => From Options => Security and Trust => select “Full trust” => select “Sign this Template” => Create certificate.

No comments: