By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,910 Members | 1,694 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,910 IT Pros & Developers. It's quick & easy.

Weird Soap Extension Problem

P: n/a
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.HttpInput Stream")
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
Oct 19 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.HttpInput Stream")
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..

Posted from http://www.topxml.com/renntp using reNNTP: the website based NNTP reader.
Nov 3 '06 #2

P: n/a
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.HttpInput Stream")
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
Hi

I have windows application in vb.net. I am trying to access the webservice in the remote computer. The remote server is not configured to use with WSDL.

I have been provided with VB6 application it works fine.
As I am using windows form Could you please tell me how can I implement soap extention in the client application(windows form- vb or Vs 2000)?

I will be greatful for you. Please help

Many Thanks
Vaish

Posted from http://www.topxml.com/renntp using reNNTP: the website based NNTP reader.
Nov 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.