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 6668953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:05:47+00:00 2026-05-26T03:05:47+00:00

This is possibly a dumb question since I’m new to all the technologies I’m

  • 0

This is possibly a dumb question since I’m new to all the technologies I’m using here (C#, .NET and SOAP). There just may not be anyway to do what I want to do here.

I’ve got an asynchronous SOAP call (code generated from WSDL) that I’m trying to alter in such a way that within my library, I’m actually making multiple calls to multiple different web servers and then aggregating the results to return back to the caller. The problem is that the SendOrPostCallback method of the asynchronous SOAP call expects to take an argument of InvokeCompletedEventArgs. I can’t construct this because the constructor is declared internal. So while I can hide what I’m doing internally, and call the callback when what I’m doing is complete, I can’t return the Results to the caller. Any suggestions?

Old Code:

public void getStatusesAsync(RequestId[] requestIds, object userState)
{
  if ((this.getStatusesOperationCompleted == null))
  {
    this.getStatusesOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetStatusesOperationCompleted);
  }
  this.InvokeAsync("getStatuses", new object[] {
                    requestIds}, this.getStatusesOperationCompleted, userState);
}

private void OngetStatusesOperationCompleted(object arg)
{
  if ((this.getStatusesCompleted != null))
  {
    System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
    this.getStatusesCompleted(this, new getStatusesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
  }
}

New Code:

public void getStatusesAsync(RequestId[] requestIds, object userState)
{
  if ((this.getStatusesOperationCompleted == null))
  {
    this.getStatusesOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetStatusesOperationCompleted);
  }
  asyncExecuteMultipleSoapCalls("getStatuses", new object[] { requestIds}, this.getStatusesOperationCompleted, userState);
}

private System.IAsyncResult asyncExecuteMultipleSoapCalls(string methodName, object[] args, System.Threading.SendOrPostCallback callback, object asyncState)
{
  Thread backgroundSoapCalls = new Thread(new ParameterizedThreadStart(asyncThreadRun));
  object[] threadArgs = new object[] { methodName, args, callback, asyncState };
  backgroundSoapCalls.Start(threadArgs);
  return null;//How to return AsyncResult?
}

private RequestStatus[] multiSoapCallResults = null;

private void asyncThreadRun(object args)
{
  string methodName = (string)(((object[])args)[0]);
  object[] methodArgs = (object[])(((object[])args)[1]);
  System.Threading.SendOrPostCallback methodCallback = (System.Threading.SendOrPostCallback)(((object[])args)[2]);
  object asyncState = (((object[])args)[3]);

  //To make a long story short, I'm using this thread to execute synchronous
  //SOAP calls, then call the event.  The reason is that different requestIds
  //in the passed in array may reside on different Web Servers.  Hopefully,
  //this will work similarly to the original Asynchronous call
  multiSoapCallResults = executeMultipleSoapCalls(methodName, methodArgs);

  //Now that I'm done, I want to pass the evenArgs to the SendOrPostCallback
  RequestStatus[] returnStatusArray = new RequestStatus[multiSoapCallResults.Length];
  multiSoapCallResults.CopyTo(returnStatusArray, 0);
  multiSoapCallResults = null;

  //This line doesn't compile of course, which is the problem
  System.Web.Services.Protocols.InvokeCompletedEventArgs eventArgs = new System.Web.Services.Protocols.InvokeCompletedEventArgs(null, false, null, returnStatusArray);

  //Need to pass event args here
  methodCallback(eventArgs);
}
  • 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-26T03:05:47+00:00Added an answer on May 26, 2026 at 3:05 am

    Turns out it was a dumb question. The wsdl generation already subclasses that InvokeCompletedEventArgs. The class I suggested making in my comment above already exists in the generated code. I just needed to find it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Forgeive me if this is a dumb question, im very new to SL, just
I am an IOS noob and this may be a dumb question, so here
Possibly a dumb question but I have a number of entities all inheriting from
I'm new to rails, so this might seem like a dumb question. I want
I'm new to git so forgive me if this is a dumb question. I
Possibly a dumb question, but I don't want to screw this up. Let's say
This could quite possibly be the dumbest question ever asked. Our client wants us
Pylint says W: 6: Using possibly undefined loop variable 'n' ... with this code:
sorry this is probably a dumb question, but I want to make the background
This is kind of a dumb question but I've aware of classic style JDE

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.