locked
Web service how to monitor http request? RRS feed

  • Question

  • Hi everyone,

    I have a web service running in my host (accepts SOAP requests)....

    I just want to monitor/read (store the HTTP url) the urls comes from my clients.

    How to do this in my server side not from the client side.

    Please help me.

    thanks

     

    Monday, December 18, 2006 7:08 AM

Answers

All replies

  • Hi,

    You can do that with a SoapExtension. A SoapExtension is a mechanism provided by ASP.NET to intercept all the SOAP messages that goes to an specific web service.

    This sample in the MSDN shows how to implement a SoapExtension to trace all the SOAP request/response messages.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebServicesProtocolsSoapExtensionClassTopic.asp

    Regards,

    Pablo.

    Monday, December 18, 2006 2:42 PM
  • thank you for your reply.

    but i want to monitor the http request (just like server.variables("remote_http") from the server side i mean from the web service. is it possible....

    IN BREIF: i want to store the http urls (hits comes from the several websites) in one text in my hosting server root folder. how to do this?

    Monday, December 18, 2006 5:44 PM
  • Hi,

    You have to add some custom code to read the server variables in your web service class, or just add that code in a soap extension.

    You can get the server variables from the HttpContext,

    HttpContext.Current.Request.ServerVariables["remote_http"]

    Regards,

    Pablo.

    Monday, December 18, 2006 6:50 PM
  • thank u again for your reply.if possible send SAMPLE web service clas custom code on how to read the server variables.looking for ur reply.
    Tuesday, December 19, 2006 2:47 AM
  • am getting an error while invoking the webservice method from my windows application:

    error message:-

    An unhandled exception of type 'System.Web.Services.Protocols.SoapException' occurred in system.web.services.dll

    Additional information: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
       at ValidationExtension.GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) in c:\inetpub\wwwroot\geometrywithvalidation\validationextension.cs:line 72
       at System.Web.Services.Protocols.SoapReflectedExtension.GetInitializer(LogicalMethodInfo methodInfo)
       at System.Web.Services.Protocols.SoapReflectedExtension.GetInitializers(LogicalMethodInfo methodInfo, SoapReflectedExtension[] extensions)
       at System.Web.Services.Protocols.SoapServerType..ctor(Type type, WebServiceProtocols protocolsSupported)
       at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
       at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

    the source code is:

    -------------------------------

    public Geo() {

    this.Url = "http://localhost/GeometryWithValidation/geo.asmx";

    }

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Add", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

    public System.Double Add(System.Double dest1, System.Double dest2, System.Double orig1, System.Double orig2) {

    object[] results = this.Invoke("Add", new object[] {

    dest1,

    dest2,

    orig1,

    orig2});

    return ((System.Double)(results[0]));

    Wednesday, December 20, 2006 7:59 AM