title: Web Service error "Error in deserializing body of reply message for operation"
body: <p>I'm getting the error below when trying to call a web service for HP Operations Orchestration. It appears the WSDL is not properly formatting the response, or I'm not properly handling the response.  Most of the things I've seen online refer to message size being too small.  This doesn't appear to be the case.  I've changed to just using var and that doesn't help.  Any ideas?</p>
  
  <p>The Call: <code>var h = OOSRClient.getFlowRunHistoryByRunId(1);</code></p>
  
  <p>The Exception:</p>
  
  <pre><code>System.ServiceModel.CommunicationException was caught
    HResult=-2146233087
    Message=Error in deserializing body of reply message for operation 'getFlowRunHistoryByRunId'.
    Source=mscorlib
    StackTrace:
      Server stack trace: 
         at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
         at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.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&amp; rpc)
         at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
         at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
         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&amp; msgData, Int32 type)
         at TestOO.OOSR.WSCentralService.getFlowRunHistoryByRunId(getFlowRunHistoryByRunIdRequest request)
         at TestOO.OOSR.WSCentralServiceClient.TestOO.OOSR.WSCentralService.getFlowRunHistoryByRunId(getFlowRunHistoryByRunIdRequest request) in c:\Users\slippi3\Documents\Visual Studio 2013\Projects\TestOO\TestOO\Service References\OOSR\Reference.cs:line 7526
         at TestOO.OOSR.WSCentralServiceClient.getFlowRunHistoryByRunId(Int64 runId) in c:\Users\slippi3\Documents\Visual Studio 2013\Projects\TestOO\TestOO\Service References\OOSR\Reference.cs:line 7532
         at TestOO.Controllers.HomeController.Index() in c:\Users\slippi3\Documents\Visual Studio 2013\Projects\TestOO\TestOO\Controllers\HomeController.cs:line 118
    InnerException: System.InvalidOperationException
         HResult=-2146233079
         Message=There is an error in XML document (1, 1287).
         Source=System.Xml
         StackTrace:
              at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
              at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
              at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
         InnerException: System.InvalidCastException
              HResult=-2147467262
              Message=Cannot assign object of type System.Object[] to an object of type TestOO.OOSR.WSRunHistoryDetailsExtend[].
              Source=ma3ir41a
              StackTrace:
                   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderWSCentralService.Read90_Item()
                   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer45.Deserialize(XmlSerializationReader reader)
                   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
              InnerException: 
  </code></pre>
  
  <p>Here's the response:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;soapenv:Body&gt;
      &lt;ns1:getFlowRunHistoryByRunIdResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://wscentralservice.services.dharma.iconclude.com"&gt;
  
  &lt;getFlowRunHistoryByRunIdReturn soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt;
  &lt;getFlowRunHistoryByRunIdReturn xsi:type="ns2:WSRunHistoryDetailsExtend" xmlns:ns2="http://iconclude.com/webservices/rss/v2.0/soap"&gt;
  &lt;uuid xsi:type="xsd:string"&gt;1111ac59-6bbe-47fa-841f-94e56c1b2111&lt;/uuid&gt;
  &lt;flowRevision xsi:type="xsd:string"&gt;4&lt;/flowRevision&gt;
  &lt;runHistoryId xsi:type="xsd:long"&gt;1&lt;/runHistoryId&gt;
  &lt;runName xsi:type="xsd:string"&gt;&lt;/runName&gt;
  &lt;userId xsi:type="xsd:string"&gt;AA\AAAAAAA&lt;/userId&gt;
  &lt;status xsi:type="xsd:string"&gt;Resolved&lt;/status&gt;
  &lt;startTime xsi:type="xsd:long"&gt;1302621361380&lt;/startTime&gt;
  &lt;duration xsi:type="xsd:long"&gt;100&lt;/duration&gt;
  &lt;numSteps xsi:type="xsd:int"&gt;5&lt;/numSteps&gt;
  &lt;scheduledBy xsi:type="xsd:string" xsi:nil="true"/&gt;
  &lt;/getFlowRunHistoryByRunIdReturn&gt;
  &lt;/getFlowRunHistoryByRunIdReturn&gt;
  &lt;/ns1:getFlowRunHistoryByRunIdResponse&gt;
  &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>