[quoted text, click to view] > Hi,
>
> I'm writing a simple soap extension for a webservice I developed (without
> the use of an extension the webservice works perfect).
> The extension is registered through the web.config files of my webservice
> and my application.
> In my extension I override the Chainstream method and implement the abstract
> methods (GetInitializer, Initialize and ProcessMessage)
>
> my chainstream method:
> Stream _Original;
> Stream _Chainned;
>
> public override Stream ChainStream( Stream stream )
> {
> _Original = stream;
> _Chainned = new MemoryStream();
> return _Chainned;
> }
>
> my GetInitializer methods return null.
> The processMessage (simplified) function:
>
> public override void ProcessMessage(SoapMessage message)
> {
> switch (message.Stage)
> {
> case SoapMessageStage.BeforeSerialize:
> if(message is System.Web.SoapClientMessage)
> System.Diagnostics.Debug.WriteLine("Client
> BeforeSerialize");
> else
> System.Diagnostics.Debug.WriteLine("Server
> BeforeSerialize");
> break;
> case SoapMessageStage.AfterSerialize:
> if(message is System.Web.SoapClientMessage)
> System.Diagnostics.Debug.WriteLine("Client
> AfterSerialize");
> else
> System.Diagnostics.Debug.WriteLine("Server
> AfterSerialize");
> break;
> case SoapMessageStage.BeforeDeserialize:
> if(message is System.Web.SoapClientMessage)
> System.Diagnostics.Debug.WriteLine("Client
> BeforeDeserialize");
> else
> System.Diagnostics.Debug.WriteLine("Server
> BeforeDeserialize");
> break;
> case SoapMessageStage.AfterDeserialize:
> if(message is System.Web.SoapClientMessage)
> System.Diagnostics.Debug.WriteLine("Client
> AfterDeserialize");
> else
> System.Diagnostics.Debug.WriteLine("Server
> AfterDeserialize");
> break;
> }
> }
>
> So far the introduction, my problem is the following:
> When I register the extension on both the client and the server and set a
> breakpoint on the line "Server BeforeDeserialize",
> the _Original and _Chainned variables are null => no soap message is
> available.
> When I register the extension on only the server then the two variables are
> also null but when I then change the ChainStream method to
> public override Stream ChainStream( Stream stream )
> {
> if(stream.GetType().FullName="System.Web.HttpInputStream")
> return stream;
> _Original = stream;
> _Chainned = new MemoryStream();
> return _Chainned;
> }
>
> everything works perfect for the server side.
>
> I've tried a lot of different things but nothing seems to resolve my
> problem.
> It looks like I'm unable to send the soap request from my client to my
> server, in "Client AfterSerialize" everything is perfect but in "Server
> BeforeDeserialize" no message has been received.
>
> Is there anyone who knows what I'm doing wrong?
>
> Thx in advance
>
> Frederik
>
Probably you dont need to override the chainstream,
void Copy(Stream from, Stream to)
{
TextReader reader = new StreamReader(from);
TextWriter writer = new StreamWriter(to);
writer.WriteLine(reader.ReadToEnd());
writer.Flush();
}
try this..