If I send back valid XML from global.asax I don't get an exception until I try and use the result object which is where the NullReference comes in.
If I send back invalid XML from global.asax I get a stack trace of:
{System.Xml.XmlException: [Xml_TagMismatch]
Arguments:faultstring,1,soap:Fault
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=System.Xml.dll&Key=Xml_TagMismatch [Xml_ErrorPosition]
Arguments:1,187
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=System.Xml.dll&Key=Xml_ErrorPosition
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlDictionaryReader.XmlWrappedReader.Read()
at System.Xml.XmlReader.SkipSubtree()
at System.Xml.XmlReader.Skip()
at System.ServiceModel.Dispatcher.OperationFormatter.TraceAndSkipElement(XmlReader xmlReader)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, 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.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at
I'm playing around with sending back different payloads from global.asax to try and somehow get an exception thrown with the payload in the e.Error.Message but so far haven't been able to. An example of a payload I've tried sending is:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault><faultcode>soap:Server</faultcode><faultstring>Test fault message</faultstring><detail /></soap:Fault> </soap:Body></soap:Envelope>
Regards,
Aaron