Note that there are some explanatory texts on larger screens.

plurals
  1. POMy SoapExtension is receiving the AfterSerialize message twice!
    text
    copied!<p>I'm using Visual Studio 2010 and C# to write a web service that requires special handling that I'm solving by rolling my own SoapExtension. This SoapExtension is of course implementing the <em>ProcessMessage</em> method.</p> <p>This is all fine, but for some reason this <em>ProcessMessage</em> is being called twice (two, 2 times) for each of the Stages of the SoapServerMessage and that is my problem. Any help with figuring out why this is and how I can make it only be called once (one, 1 time), would be highly appreciated.</p> <p>BTW: I have found others on the web that have been having a similar problem, like this <a href="http://www.mofeel.net/55-microsoft-public-dotnet-framework-aspnet-webservices/2202.aspx" rel="nofollow noreferrer">guy at mofeel.com</a>, which indicates that he found the solution <a href="http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22045885.html" rel="nofollow noreferrer">here at experts-exchange.com</a> but I will not give out my creditcard for the solution. That is a principle. Can someone help me, please?</p> <p>My <em>ProcessMessage</em> method looks like this:</p> <pre><code>public override void ProcessMessage(SoapMessage message) { if (message is SoapServerMessage) { LogFile.WriteLogString(0, "-------------------"); LogFile.WriteLogString(0, "message.Type:" + message.GetType().ToString()); LogFile.WriteLogString(0, "message.Stage:" + message.Stage); LogFile.WriteLogString(0, "message.Stream.Length:" + message.Stream.Length); LogFile.WriteLogString(0, "message.Stream.Position:" + message.Stream.Position); LogFile.WriteLogString(0, "message.Exception:" + message.Exception); ProcessServerMessage(message); } else ProcessClientMessage(message); } </code></pre> <p>...and when I make a single call to my web method I get a log looking like this:</p> <pre><code>7.7.2010 17:40:25: -------- Log file opened -------- 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:BeforeDeserialize 7.7.2010 17:40:27: [0] message.Stream.Length:0 7.7.2010 17:40:27: [0] message.Stream.Position:0 7.7.2010 17:40:27: [0] message.Exception: 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:BeforeDeserialize 7.7.2010 17:40:27: [0] message.Stream.Length:0 7.7.2010 17:40:27: [0] message.Stream.Position:0 7.7.2010 17:40:27: [0] message.Exception: 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:AfterDeserialize 7.7.2010 17:40:27: [0] message.Stream.Length:330 7.7.2010 17:40:27: [0] message.Stream.Position:330 7.7.2010 17:40:27: [0] message.Exception: 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:AfterDeserialize 7.7.2010 17:40:27: [0] message.Stream.Length:330 7.7.2010 17:40:27: [0] message.Stream.Position:330 7.7.2010 17:40:27: [0] message.Exception: 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:BeforeSerialize 7.7.2010 17:40:27: [0] message.Stream.Length:0 7.7.2010 17:40:27: [0] message.Stream.Position:0 7.7.2010 17:40:27: [0] message.Exception: 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:BeforeSerialize 7.7.2010 17:40:27: [0] message.Stream.Length:0 7.7.2010 17:40:27: [0] message.Stream.Position:0 7.7.2010 17:40:27: [0] message.Exception: 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:AfterSerialize 7.7.2010 17:40:27: [0] message.Stream.Length:480 7.7.2010 17:40:27: [0] message.Stream.Position:480 7.7.2010 17:40:27: [0] message.Exception: 7.7.2010 17:40:27: [0] ------------------- 7.7.2010 17:40:27: [0] message.Type:System.Web.Services.Protocols.SoapServerMessage 7.7.2010 17:40:27: [0] message.Stage:AfterSerialize 7.7.2010 17:40:27: [0] message.Stream.Length:480 7.7.2010 17:40:27: [0] message.Stream.Position:480 7.7.2010 17:40:27: [0] message.Exception: </code></pre> <p>Notice how every message stage is being called twice?!?!?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload