Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 888105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:20:29+00:00 2026-05-15T13:20:29+00:00

I am sure this is an easy question however I am not finding the

  • 0

I am sure this is an easy question however I am not finding the solution. I want to save the XML files posted to my .NET Web Service. I am sure it is just a simple method call when the service is invoked but I am not finding it. I would like to save the full XML posted to the service

Any help would be greatly appreciated. Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:20:30+00:00Added an answer on May 15, 2026 at 1:20 pm

    Thank you for your help however I found what I was looking for at http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension.aspx

    To help anyone else that is new to tring to implement this via WebService’s I included the steps that I performed to implement it and modifications so I could save it to the db as well as the file system I performed the following steps. If you have any questions please feel free to aks and I will be happy to answer.

    1. Created a code file in my web service project with the code listed in the in the article
    2. Created a few properties to store values to save to the db

      private string _requestXml;
      private DateTime _start;
      
    3. Then I modified the WriteInput method to save values to those variables.

      public void WriteInput(SoapMessage message)
      {
          //Begin Edit
          oldStream.Position = 0;
          _requestXml = new StreamReader(_oldStream).ReadToEnd();
          _start = DateTime.UtcNow;
          //End Edit
          //Begin Original Code
          oldStream.Position = 0;
          Copy(oldStream, newStream);
          var fs = new FileStream(filename, FileMode.Append, FileAccess.Write);
          var w = new StreamWriter(fs);
          var soapString = (message is SoapServerMessage) ? "SoapRequest" : "SoapResponse";
          w.WriteLine("-----" + soapString + " at " + DateTime.Now);
          w.Flush();
          newStream.Position = 0;
          Copy(newStream, fs);
          w.Close();
          newStream.Position = 0;
      }
      
    4. Then I modified the WriteOutput to

      public void WriteOutput(SoapMessage message)
      {
          //Begin Edit
          var responseXml = new StreamReader(newStream).ReadToEnd();
          newStream.Position = 0;
          //Start process for saving to DB 
          //"_requestXml" = Original Request Soap Message
          //"responseXml" = Service Returned Response
          //"_start" = Request Start Time
          //message.MethodInfo.Name = I save this so I know what method from     
          //message.Url = I save this so I know the original ASMX that was hit
          //End Edit
          //Begin Original Code
          newStream.Position = 0;
          var fs = new FileStream(filename, FileMode.Append, FileAccess.Write);
          var w = new StreamWriter(fs);
          var soapString = (message is SoapServerMessage) ? "SoapResponse" : "SoapRequest";
          w.WriteLine("-----" + soapString + " at " + DateTime.Now);
          w.Flush();
          Copy(newStream, fs);
          w.Close();
          newStream.Position = 0;
          Copy(newStream, oldStream);
      }
      
    5. Now all that’s left is to add the following to your service call and you should be good to go

      [WebMethod, NameSpace.OfyourTraceExtesionClass.TraceExtension]
      public void WebMethod1()
      {
          //DoSomeStuff
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure this is an easy question, but I don't have an answer for.
I'm sure this is a easy question, my Google-fu is obviously failing me. How
I am sure this is an easy question, but one that has escaped me
This should be easy, but I'm not sure how to best go about it.
I'm sure this is going to end up being a super silly question/answer, however
I'm sure this question will be easy for you lot... :) I'm simply trying
I am sure this is a very easy question for many, but I am
I am sure that for most this is a very easy question. But I
I'm sure this is easy but I can't figure it out: I have an
I am sure this is easy - but I can't figure it out right

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.