Re: HttpModules - Webservices



Bruce:

Also wanted to point out you might consider a tool look Fiddler to
eyeball the request/response from a client machine and see if there
are obvious differences.

http://www.fiddlertool.com/fiddler/

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/


On Wed, 11 May 2005 20:30:57 +0100, "Bruce Hodge"
<support@xxxxxxxxxxxxxxxxxx> wrote:

>Hi,
>
>We have a couple of clients who are having trouble connecting to .Net
>webservices, (they're coming from PHP and VFP). We were looking to provide
>a diagonostic tool that displayed the soap message submitted so that if the
>call failed they could compare their SoapMessage with the ones we generate
>in .Net.
>
>Thought the solution was an HttpModule hooked into begin request, but after
>approx 10 requests it hangs the webservice/aspnet service, any thoughts?
>Code below.
>
>(The HttpRequests are stored in Typed Dataset, stored on the Application
>object so that they can be accessed from webpages.)
>
>
>public void OnBeginRequest(Object s, EventArgs e)
>{
> try
> {
> // Cast the Object to the HttpApplication variable.
> HttpApplication app = (HttpApplication)s;
>
> HttpRequest newRequest = app.Request;
>
> string servers = this.ServicesToMonitor();
> int posn =
>servers.ToLower().IndexOf(this.GetServiceName(newRequest).ToLower());
>
> if (posn > -1)
> this.AddFromHttpRequest(this.RequestHistory, newRequest);
>
> }
>
> catch (Exception ex)
> {
> //Custom error logging code
> }
>
>}
>
>private void AddFromHttpRequest(Mars.Schema.HttpRequests history,
>HttpRequest request)
>{
> try
> {
> HttpContext.Current.Application.Lock();
>
> byte [] byteArray = new byte[request.ContentLength];
>
> request.InputStream.Read(byteArray, 0, request.ContentLength);
>
> // Must reset the Input Stream position or the whole process fails.
> request.InputStream.Position = 0;
>
> Mars.Schema.HttpRequests.RequestsRow row =
>this.RequestHistory.Requests.AddRequestsRow(
>
>
> request.RawUrl,
> request.HttpMethod,
> request.ContentType,
> request.ContentLength,
> Encoding.ASCII.GetString(byteArray, 0, request.ContentLength),
> DateTime.Now,
> this.GetServiceName(request),
> this.SOAPAction(request),
> request.ServerVariables["REMOTE_ADDR"]);
>
> foreach (string s in request.Headers.AllKeys)
> this.RequestHistory.HttpHeaders.AddHttpHeadersRow(row.RequestID,
>s, request.Headers[s]);
>
> while (this.RequestHistory.Requests.Count > this.HistorySize)
> {
> this.RequestHistory.Requests[0].Delete();
> }
>
> this.RequestHistory.AcceptChanges();
>
> HttpContext.Current.Application.UnLock();
>
> }
>
> catch (Exception ex)
> {
>
> #region Catch Block
>
> #endregion
>
> HttpContext.Current.Application.UnLock();
>
> }
>
>}

.



Relevant Pages

  • Re: HttpModules - Webservices
    ... >Thought the solution was an HttpModule hooked into begin request, ... >public void OnBeginRequest ... > catch (Exception ex) ... >HttpRequest request) ...
    (microsoft.public.dotnet.framework.aspnet)
  • HttpModules - Webservices
    ... webservices,. ... Thought the solution was an HttpModule hooked into begin request, ... public void OnBeginRequest ... catch (Exception ex) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Outlook 2000 Question
    ... PS. Hope you understand my English (I'm not from an English talking ... >>> solely to do with the client machine. ... >>> format? ... >>> request ...
    (microsoft.public.outlook)
  • Re: Certificate Authority web enrollment error
    ... Is the CA machine reachable from the client machine on which the request ... The client machine should be in the same domain as the CA machine or both ... > CCertRequest::Submit The RPC server is unavailable. ... > The Certification Authority Service has not been started. ...
    (microsoft.public.win2000.security)
  • Radius server ans NAS keys dont match! ?
    ... I am trying to work with Radius on a FreeBSD machine. ... When I try radlogin on the client machine, I get the following message from ... +- entering group PAP ... Delaying reject of request 1 for 1 seconds ...
    (freebsd-questions)