Click here to Skip to main content
15,909,325 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionwrite dataset to a database Pin
keroed_edmond6-Aug-06 14:13
keroed_edmond6-Aug-06 14:13 
AnswerRe: write dataset to a database Pin
postmaster@programmingknowledge.com6-Aug-06 16:55
postmaster@programmingknowledge.com6-Aug-06 16:55 
QuestionHow do I stop the Parent masterpage from performaing a refresh when the child masterpage's content placeholder fires a redirect causing flickering at the master page level. Pin
RoahRash6-Aug-06 13:50
RoahRash6-Aug-06 13:50 
AnswerRe: How do I stop the Parent masterpage from performaing a refresh when the child masterpage's content placeholder fires a redirect causing flickering at the master page level. Pin
Guffa6-Aug-06 21:43
Guffa6-Aug-06 21:43 
GeneralRe: How do I stop the Parent masterpage from performaing a refresh when the child masterpage's content placeholder fires a redirect causing flickering at the master page level. Pin
RoahRash7-Aug-06 5:52
RoahRash7-Aug-06 5:52 
GeneralRe: How do I stop the Parent masterpage from performaing a refresh when the child masterpage's content placeholder fires a redirect causing flickering at the master page level. [modified] Pin
RoahRash7-Aug-06 11:00
RoahRash7-Aug-06 11:00 
AnswerRe: How do I stop the Parent masterpage from performaing a refresh when the child masterpage's content placeholder fires a redirect causing flickering at the master page level. Pin
Guffa7-Aug-06 13:25
Guffa7-Aug-06 13:25 
QuestionSOAP extension code not executing Pin
Leithaus6-Aug-06 9:03
Leithaus6-Aug-06 9:03 
All,

i am creating a gateway application that speaks SOAP out of one side and a proprietary network protocol out of the other. i would like to use SOAP extensions to 'trampoline' the incoming SOAP message into the proprietary network format and send it on to the appropriate stream.

i have set up a little test of the SOAP extension framework by copying and modifying the trace extension sample from the .net framework library. However, i cannot get even this sample to execute the code associated with the extension.

Below are the relevant snippets of code. Any help would be greatly appreciated.

FYI, i have tried several variations of the setup below, including

1. with and without the remove HTTP[GET,POST] in the protocols section of the webservices element -- per the Developmentor sample;
2. posting the request in different ways
a. from the asp page generated by asp.net from the wsdl
b. using a little jscript tool for posting cribbed from the Developmentor sample

Note also that everything is packaged up in a single assembly, APP_Code.dll, and this seems to match the expectations asp.net has regarding the web.config.

Best wishes,

--greg

//SOAP extension code

namespace AVSOAPIntercept {

...

public class AVTraceExtension : SoapExtension
{
Stream oldStream;
Stream newStream;
string filename;

// Save the Stream representing the SOAP request or SOAP response into
// a local memory buffer.
public override Stream ChainStream( Stream stream )
{
oldStream = stream;
newStream = new MemoryStream();
return newStream;
}

// When the SOAP extension is accessed for the first time, the XML Web
// service method it is applied to is accessed to store the file
// name passed in, using the corresponding SoapExtensionAttribute.
public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
{
return ((AVTraceExtensionAttribute) attribute).Filename;
}

// The SOAP extension was configured to run using a configuration file
// instead of an attribute applied to a specific XML Web service
// method.
public override object GetInitializer(Type WebServiceType)
{
// Return a file name to log the trace information to, based on the
// type.
return "C:\\" + WebServiceType.FullName + ".log";
}

// Receive the file name stored by GetInitializer and store it in a
// member variable for this specific instance.
public override void Initialize(object initializer)
{
filename = (string) initializer;
}

// If the SoapMessageStage is such that the SoapRequest or
// SoapResponse is still in the SOAP format to be sent or received,
// save it out to a file.
public override void ProcessMessage(SoapMessage message)
{
switch (message.Stage)
{
case SoapMessageStage.BeforeSerialize:
break;
case SoapMessageStage.AfterSerialize:
WriteOutput(message);
break;
case SoapMessageStage.BeforeDeserialize:
WriteInput(message);
break;
case SoapMessageStage.AfterDeserialize:
break;
default:
throw new Exception("invalid stage");
}
}

public void WriteOutput(SoapMessage message)
{
newStream.Position = 0;
FileStream fs = new FileStream(filename, FileMode.Append,
FileAccess.Write);
StreamWriter w = new StreamWriter(fs);

string soapString = (message is SoapServerMessage) ? "SoapResponse" : "SoapRequest";
w.WriteLine("-----" + soapString + " at " + DateTime.Now);
w.WriteLine("The method that has been invoked is: ");
w.WriteLine("\t" + message.MethodInfo);


w.Flush();
Copy(newStream, fs);
w.Close();
newStream.Position = 0;
Copy(newStream, oldStream);
}

public void WriteInput(SoapMessage message)
{
Copy(oldStream, newStream);
FileStream fs = new FileStream(filename, FileMode.Append,
FileAccess.Write);
StreamWriter w = new StreamWriter(fs);

string soapString = (message is SoapServerMessage) ?
"SoapRequest" : "SoapResponse";
w.WriteLine("-----" + soapString +
" at " + DateTime.Now);
w.WriteLine("The method that has been invoked is: ");
w.WriteLine("\t" + message.MethodInfo);

w.Flush();
newStream.Position = 0;
Copy(newStream, fs);
w.Close();
newStream.Position = 0;
}

void Copy(Stream from, Stream to)
{
TextReader reader = new StreamReader(from);
TextWriter writer = new StreamWriter(to);
writer.WriteLine(reader.ReadToEnd());
writer.Flush();
}
}

// Create a SoapExtensionAttribute for the SOAP Extension that can be
// applied to an XML Web service method.
[AttributeUsage(AttributeTargets.Method)]
public class AVTraceExtensionAttribute : SoapExtensionAttribute
{

private string filename = "c:\\log.txt";
private int priority;

public override Type ExtensionType
{
get { return typeof(AVTraceExtension); }
}

public override int Priority
{
get { return priority; }
set { priority = value; }
}

public string Filename
{
get
{
return filename;
}
set
{
filename = value;
}
}
}
...
}

// Method decoration
[AVTraceExtension]
[WebMethod(EnableSession=true)]
public void AV_LOGIN(string loginName, string application, string appVersionStr, string SysInfo) {
// Code that ought to be in the trampoline
}
}




<configuration>
<appsettings>
<connectionstrings>
<system.web>


<trace enabled="true"> <compilation debug="true">

<authentication mode="Windows">

<webservices>
<protocols>
<remove name="HttpPost">
<remove name="HttpGet">

<soapextensiontypes>
<add type="AVSOAPIntercept.AVTraceExtension,
App_Code"
="" priority="1" group="Low">





Questioninserting data thru web forms Pin
Kunal P6-Aug-06 0:22
Kunal P6-Aug-06 0:22 
AnswerRe: inserting data thru web forms Pin
enjoycrack6-Aug-06 3:13
enjoycrack6-Aug-06 3:13 
AnswerRe: inserting data thru web forms Pin
blurMember6-Aug-06 16:14
blurMember6-Aug-06 16:14 
Questionword documents Pin
Robske5-Aug-06 23:41
Robske5-Aug-06 23:41 
AnswerRe: word documents Pin
Mike Ellison6-Aug-06 5:08
Mike Ellison6-Aug-06 5:08 
Questionasp.net media player -not media server Pin
User 9625785-Aug-06 19:25
User 9625785-Aug-06 19:25 
QuestionWhere can i find AJAX Tutorials Pin
Kariem Soudy5-Aug-06 15:15
Kariem Soudy5-Aug-06 15:15 
AnswerRe: Where can i find AJAX Tutorials Pin
Ravi Bhavnani6-Aug-06 15:03
professionalRavi Bhavnani6-Aug-06 15:03 
QuestionNo, i need a reference - Re: Where can i find AJAX Tutorials Pin
Kariem Soudy6-Aug-06 20:52
Kariem Soudy6-Aug-06 20:52 
AnswerRe: No, i need a reference - Re: Where can i find AJAX Tutorials Pin
ravindradonkada7-Aug-06 7:27
ravindradonkada7-Aug-06 7:27 
QuestionImageButton and border attributes [modified] Pin
matthias s.5-Aug-06 8:26
matthias s.5-Aug-06 8:26 
AnswerRe: ImageButton and border attributes Pin
minhpc_bk7-Aug-06 15:38
minhpc_bk7-Aug-06 15:38 
GeneralRe: ImageButton and border attributes Pin
matthias s.7-Aug-06 22:37
matthias s.7-Aug-06 22:37 
GeneralRe: ImageButton and border attributes Pin
minhpc_bk8-Aug-06 0:02
minhpc_bk8-Aug-06 0:02 
GeneralRe: ImageButton and border attributes Pin
matthias s.8-Aug-06 0:19
matthias s.8-Aug-06 0:19 
GeneralRe: ImageButton and border attributes Pin
minhpc_bk8-Aug-06 0:28
minhpc_bk8-Aug-06 0:28 
QuestionDataset To Label (vs2005) Pin
NiPsTeRs5-Aug-06 5:41
NiPsTeRs5-Aug-06 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.