Server-Side Async Web Methods call fails

Discussion in 'ASP .Net Web Services' started by altialex, May 18, 2004.

  1. altialex

    altialex Guest

    I have WS implementing DIME 1.0. Primary client is ASP.NET Web application
    consuming WS through proxy.
    I though it might be beneficial from the performance stand point to
    implement some WS methods asynchronously. I've read msdn article "Server
    side Asynchronous Web Methods"
    and basically copied the sample into my WS.
    public delegate string DummyAsyncStub(int milliseconds);
    public class DummyAsyncState {
    public object previousState;
    public DummyAsyncStub asyncStub;
    internal string myLengthyProcedure(int milliseconds) {
    return "Success";
    public System.IAsyncResult BeginLengthyProcedure(int milliseconds,
    System.AsyncCallback cb, object s) {
    DummyAsyncState ms = new DummyAsyncState();
    ms.previousState = s;
    ms.asyncStub = new DummyAsyncStub(myLengthyProcedure);
    return ms.asyncStub.BeginInvoke(milliseconds, cb, ms);
    public string EndLengthyProcedure(System.IAsyncResult asyncResult) {
    DummyAsyncState ms = (DummyAsyncState)asyncResult.AsyncState;
    return ms.asyncStub.EndInvoke(asyncResult);
    After I call LengthyProcedure through the proxy I get an exception:

    System.Web.Services.Protocols.SoapException: Server was unable to process
    request. ---> System.NullReferenceException: Object reference not set to an
    instance of an object.
    at Microsoft.Web.Services.SoapEnvelope..ctor(SoapContext context)
    at Microsoft.Web.Services.WebServicesExtension.AfterSerialize(SoapMessage
    at Microsoft.Web.Services.WebServicesExtension.ProcessMessage(SoapMessage
    at System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[]
    returnValues, Stream outputStream)
    at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[]
    at System.Web.Services.Protocols.WebServiceHandler.EndInvoke(IAsyncResult
    --- End of inner exception stack trace ---

    I'm pretty much baffled about what I did wrong? Is DIME 1.0 relevant in this
    case for some reason?
    The funny thing is that the same method call completes without a hitch if
    consumed by Java (Axis) client.
    Can anyone help me?
    altialex, May 18, 2004
    1. Advertisements

  2. altialex

    altialex Guest

    Never mind. Found the answer in webservices.enhancements newsgroup.
    "HttpContext.Current = this.Context ad the end of async method call." in
    case some1 else's wondering about this.
    Regards, Alex

    "altialex" <> wrote in message
    > Hi.
    altialex, May 18, 2004
    1. Advertisements

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.

Share This Page