web service ( + WSE 2.0 ) hangs after adding an output filter

Discussion in 'ASP .Net Web Services' started by DaberElay, Jun 27, 2004.

  1. DaberElay

    DaberElay Guest

    Hi,
    I have a server that returns a dataset of over 10,000 records. i added a output filter to the web.config file and i zip the body,create an empty body and add the zip as an attachment ( using #ZipLib freeware project ) in the processMessage method, it all runs fine and in a responsive manner.
    on the client side i add an input filter to the pipeline that do exactly the oposite : i unzip the attachment & replace the body with the unzip version.

    i have 2 problems : 1. between the server's filter end of call and the call to the client filter, i'm unresponsive for as much as +30 seconds ( changing each run ).
    2. the client filter is being called twice, i can overcome this but it proves that there is a problem.

    I attached the code in question,

    please advise,
    much appriciated.



    server side code :
    XmlElement soapHeader = envelope.CreateHeader();
    XmlDocument document = soapHeader.OwnerDocument;
    XmlElement customHeader = document.CreateElement( "ZipFilter" );
    customHeader.SetAttribute("bZipped","1");
    soapHeader.AppendChild(customHeader);

    MemoryStream original = new MemoryStream( System.Text.Encoding.UTF8.GetBytes(envelope.Body.InnerXml ) );

    MemoryStream Zipped = new MemoryStream();
    ICSharpCode.SharpZipLib.BZip2.BZip2.Compress( original,Zipped,1024);

    MemoryStream res = new MemoryStream( Zipped.GetBuffer() );
    Microsoft.Web.Services2.Attachments.Attachment attch = new Microsoft.Web.Services2.Attachments.Attachment( "APPLICATION/OCTET-STREAM",res );
    envelope.Context.Attachments.Add( attch );
    XmlElement newBody = envelope.CreateBody();
    newBody.RemoveAll();
    envelope.SetBodyObject( newBody );

    client side code :
    XmlNodeList elemList = envelope.Header.GetElementsByTagName("ZipFilter");
    if ( elemList[0].Attributes["bZipped"].Value.Equals("0") )
    return;
    envelope.Header.RemoveChild( elemList[0] );
    Stream original = envelope.Context.Attachments[0].Stream;
    MemoryStream UnZipped = new MemoryStream();
    ICSharpCode.SharpZipLib.BZip2.BZip2.Decompress( original,UnZipped );
    XmlElement body = envelope.CreateBody();
    body.InnerXml = System.Text.Encoding.UTF8.GetString( UnZipped.GetBuffer() );
    DaberElay, Jun 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shawn
    Replies:
    0
    Views:
    353
    Shawn
    Feb 19, 2006
  2. Daniel Johansson

    Bug in WSE for C++ Web Service?

    Daniel Johansson, Aug 25, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    106
    Daniel Johansson
    Aug 25, 2003
  3. Naresh

    Has anyone tried using cache within WSE filter??

    Naresh, Oct 12, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    90
    Naresh
    Oct 12, 2003
  4. Chakra

    Proxy for WSE 2 enabled web service ?

    Chakra, Feb 26, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    131
    Mark A. Deal
    Feb 28, 2005
  5. Debuging ASP.NET Web Service with WSE 3.0

    , Feb 6, 2006, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    258
    Jeremy
    Apr 30, 2006
Loading...

Share This Page