SoapExtension logging to SQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark A. Richman

    #1

    SoapExtension logging to SQL

    Does anyone have an example of a SoapExtension that writes the incoming SOAP request to a table via SQL? I have tried editing the TraceExtension sample code on MSDN with little success.

    I am not entirely sure what the newStream/oldStream members would be used for in a SQL logging scenario. I just want to inspect the incoming message, not modify it. From the API docs, it doesn't look like I'd need to override ChainStream() at all.

    Any ideas?

    --
    MARK RICHMAN
  • Dino Chiesa [Microsoft]

    #2
    Re: SoapExtension logging to SQL

    (removing a few groups)
    I haven't done this but it shouldn't be difficult. what do you mean "with
    little success"? what problems did you encounter?
    -Dino


    "Mark A. Richman" <nospam@nospam. com> wrote in message
    news:%23ZlYHA11 EHA.1188@tk2msf tngp13.phx.gbl. ..
    Does anyone have an example of a SoapExtension that writes the incoming SOAP
    request to a table via SQL? I have tried editing the TraceExtension sample
    code on MSDN with little success.

    I am not entirely sure what the newStream/oldStream members would be used
    for in a SQL logging scenario. I just want to inspect the incoming message,
    not modify it. From the API docs, it doesn't look like I'd need to override
    ChainStream() at all.

    Any ideas?

    --
    MARK RICHMAN


    Comment

    • Mark A. Richman

      #3
      Re: SoapExtension logging to SQL

      I forgot to set the message.Stream. Position = 0 before I exited my SoapExtension! I do not need to use ChainStream either:

      public override void ProcessMessage( SoapMessage message)
      {
      switch(message. Stage)
      {
      case SoapMessageStag e.BeforeSeriali ze:
      break;
      case SoapMessageStag e.AfterSerializ e:
      break;
      case SoapMessageStag e.BeforeDeseria lize:
      WriteInput(mess age);
      break;
      case SoapMessageStag e.AfterDeserial ize:
      break;
      default:
      throw new Exception("inva lid stage");
      }
      }

      /// <summary>
      /// Writes the incoming SOAP message to SQL
      /// </summary>
      /// <param name="message"> </param>
      private void WriteInput(Soap Message message)
      {
      System.IO.Strea mReader sr = new System.IO.Strea mReader(message .Stream);
      parameters = sr.ReadToEnd();

      object[] parms = { parameters };

      SqlHelper.Execu teNonQuery(con, "InsertSoapMess age", parms);

      message.Stream. Position = 0;
      }
      }

      --
      MARK RICHMAN
      "Dino Chiesa [Microsoft]" <dinoch@online. microsoft.com> wrote in message news:OyE1xg11EH A.3236@TK2MSFTN GP15.phx.gbl...
      (removing a few groups)
      I haven't done this but it shouldn't be difficult. what do you mean "with
      little success"? what problems did you encounter?
      -Dino


      "Mark A. Richman" <nospam@nospam. com> wrote in message
      news:%23ZlYHA11 EHA.1188@tk2msf tngp13.phx.gbl. ..
      Does anyone have an example of a SoapExtension that writes the incoming SOAP
      request to a table via SQL? I have tried editing the TraceExtension sample
      code on MSDN with little success.

      I am not entirely sure what the newStream/oldStream members would be used
      for in a SQL logging scenario. I just want to inspect the incoming message,
      not modify it. From the API docs, it doesn't look like I'd need to override
      ChainStream() at all.

      Any ideas?

      --
      MARK RICHMAN

      Comment

      Working...