I have a bunch of web services that hook into NPM via .NET using the SolarWinds.InformationService.Contract2.dll -- Been working great to display information to users that do not have direct access to NPM for information sharing; however, we upgraded to NPM 10.5 this afternoon and the InfoProxyService.Read(nodeuri) method throws an Exception I'm not sure what to make of. I made no changes to my .NET code prior to or after the upgrade - after observing the first exception I upgraded from SDK 1.5 to SDK 1.6 using http://thwack.solarwinds.com/thread/39001
Below is the detailed exception (traced into the InfoProxyService.Read() method where it seems XML is parsing 'False' as a Boolean and throwing the error - and some example code that generates the same exception I'm seeing in my production applications.
Any ideas?
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=There was an error while trying to deserialize parameter http://schemas.solarwinds.com/2007/08/informationservice:ReadResult. Please see InnerException for more details.
Source=mscorlib
StackTrace:
Server stack trace:
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at SolarWinds.InformationService.Contract2.IInformationService.Read(String uri)
at SolarWinds.InformationService.Contract2.InfoServiceProxy.Read(String uri)
at OrionDebug.Program.Main(String[] args) in c:\Users\dmorrison\Documents\Visual Studio 2012\Projects\OrionDebug\OrionDebug\Program.cs:line 39
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.InvalidOperationException
HResult=-2146233079
Message=There is an error in XML document (1, 34).
Source=System.Xml
StackTrace:
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)
at SolarWinds.InformationService.Contract2.Serialization.XmlStrippedSerializer.DeserializeFromStrippedXml(String strippedXml)
at SolarWinds.InformationService.Contract2.PropertyBag.ReadXml(XmlReader reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadIXmlSerializable(XmlSerializableReader xmlSerializableReader, XmlReaderDelegator xmlReader, XmlDataContract xmlDataContract, Boolean isMemberType)
at System.Runtime.Serialization.XmlDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader, XmlObjectSerializer serializer)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.PartInfo.ReadObject(XmlDictionaryReader reader)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
InnerException: System.FormatException
HResult=-2146233033
Message=The string 'False' is not a valid Boolean value.
Source=System.Xml
StackTrace:
at System.Xml.XmlConvert.ToBoolean(String s)
at System.Xml.Serialization.XmlSerializationPrimitiveReader.Read_boolean()
at System.Xml.Serialization.XmlSerializer.DeserializePrimitive(XmlReader xmlReader, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
InnerException:
using System;
using System.Net;
using System.ServiceModel;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;using SolarWinds.InformationService.Contract2;namespace OrionDebug
{
class Program
{
static void Main(string[] args)
{
String username = user
String password = pass;
String InformationServicePath = "localhost:17778/.../OrionBasic";
String swis_host = localhost; Console.WriteLine("Orion Debug Console.");
Console.WriteLine("Establish SWIS..."); // self validate certs, ha!
ServicePointManager.ServerCertificateValidationCallback = ValidateRemoteCertificate; // lots of little things so we can instantiate SWIS
Uri orion = new Uri(InformationServicePath);
UsernameCredentials creds = new UsernameCredentials(username, password);
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
InfoServiceProxy swis = new InfoServiceProxy(orion, binding, creds); // we made it this far
Console.WriteLine("Connected to {0}...", InformationServicePath); // try to read a node
int nodeid = 16810;
Console.WriteLine("Trying to read node {0}", nodeid);
/*** EXCEPTION HERE! ***/
PropertyBag node = swis.Read(String.Format("swis://{0}/Orion/Orion.Nodes/NodeID={1}", swis_host, nodeid));
Console.WriteLine("Read Node: {0}", node["Caption"].ToString()); // pause
Console.WriteLine("Press any key to end...");
Console.ReadKey();
} public static bool ValidateRemoteCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
}
}