Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Beginnt einen asynchronen Aufruf der Methode, die durch diese LogicalMethodInfo dargestellt wird.
Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in system.web.services.dll)
Syntax
'Declaration
Public Function BeginInvoke ( _
target As Object, _
values As Object(), _
callback As AsyncCallback, _
asyncState As Object _
) As IAsyncResult
'Usage
Dim instance As LogicalMethodInfo
Dim target As Object
Dim values As Object()
Dim callback As AsyncCallback
Dim asyncState As Object
Dim returnValue As IAsyncResult
returnValue = instance.BeginInvoke(target, values, callback, asyncState)
public IAsyncResult BeginInvoke (
Object target,
Object[] values,
AsyncCallback callback,
Object asyncState
)
public:
IAsyncResult^ BeginInvoke (
Object^ target,
array<Object^>^ values,
AsyncCallback^ callback,
Object^ asyncState
)
public IAsyncResult BeginInvoke (
Object target,
Object[] values,
AsyncCallback callback,
Object asyncState
)
public function BeginInvoke (
target : Object,
values : Object[],
callback : AsyncCallback,
asyncState : Object
) : IAsyncResult
Parameter
- target
Die Instanz von Object, für die die Methode aufgerufen werden soll.
- values
Eine Argumentliste für die aufgerufene Methode. Dies ist ein Array von Objekten mit derselben Nummer, derselben Reihenfolge und demselben Typ wie die Parameter der Methode. Wenn für die Methode keine Parameter erforderlich sind, sollte values NULL (Nothing in Visual Basic) sein.
- callback
Der Delegat, der aufgerufen werden soll, wenn der asynchrone Aufruf abgeschlossen ist. Wenn callback auf NULL (Nothing in Visual Basic) festgelegt ist, wird der Delegat nicht aufgerufen.
- asyncState
Die dem Delegaten übergebenen Zustandsinformationen.
Rückgabewert
Ein IAsyncResult, das an EndInvoke übergeben wird, um die Rückgabewerte des Remotemethodenaufrufs abzurufen.
Ausnahmen
| Ausnahmetyp | Bedingung |
|---|---|
Der target-Parameter ist NULL (Nothing in Visual Basic). |
|
Anzahl, Typ und Reihenfolge der Parameter in values stimmen nicht mit der Signatur der aufgerufenen Methode überein. |
|
Der Aufrufer verfügt nicht über die Berechtigung zum Aufrufen der Methode. |
Beispiel
Public Shared Sub Main()
' Get the type information.
' Note: The MyMath class is a proxy class generated by the Wsdl.exe
' utility for the Math Web Service. This class can also be found in
' the SoapHttpClientProtocol class example.
Dim myType As Type = GetType(MyMath.MyMath)
' Get the method info.
Dim myBeginMethod As MethodInfo = myType.GetMethod("BeginAdd")
Dim myEndMethod As MethodInfo = myType.GetMethod("EndAdd")
' Create an instance of the LogicalMethodInfo class.
Dim myLogicalMethodInfo As LogicalMethodInfo = _
LogicalMethodInfo.Create(New MethodInfo() {myBeginMethod, myEndMethod}, _
LogicalMethodTypes.Async)(0)
' Get an instance of the proxy class.
Dim myMathService As New MyMath.MyMath()
' Call the MyEndIntimationMethod method to intimate the end of
' the asynchronous call.
Dim myAsyncCallback As New AsyncCallback(AddressOf MyEndIntimationMethod)
' Beging to invoke the Add method.
Dim myAsyncResult As IAsyncResult = _
myLogicalMethodInfo.BeginInvoke( _
myMathService, New Object() {10, 10}, myAsyncCallback, Nothing)
' Wait until invoke is complete.
myAsyncResult.AsyncWaitHandle.WaitOne()
' Get the result.
Dim myReturnValue() As Object
myReturnValue = myLogicalMethodInfo.EndInvoke(myMathService, myAsyncResult)
Console.WriteLine(("Sum of 10 and 10 is " & myReturnValue(0)))
End Sub
' This method will be called at the end of asynchronous call.
Shared Sub MyEndIntimationMethod(ByVal Result As IAsyncResult)
Console.WriteLine("Asynchronous call on method 'Add' finished.")
End Sub
public static void Main()
{
// Get the type information.
// Note: The MyMath class is a proxy class generated by the Wsdl.exe
// utility for the Math Web service. This class can also be found in
// the SoapHttpClientProtocol class example.
Type myType = typeof(MyMath.MyMath);
// Get the method info.
MethodInfo myBeginMethod = myType.GetMethod("BeginAdd");
MethodInfo myEndMethod = myType.GetMethod("EndAdd");
// Create an instance of the LogicalMethodInfo class.
LogicalMethodInfo myLogicalMethodInfo =
(LogicalMethodInfo.Create(new MethodInfo[] {myBeginMethod,myEndMethod},
LogicalMethodTypes.Async))[0];
// Get an instance of the proxy class.
MyMath.MyMath myMathService = new MyMath.MyMath();
// Call the MyEndIntimationMethod method to intimate the end of
// the asynchronous call.
AsyncCallback myAsyncCallback = new AsyncCallback(MyEndIntimationMethod);
// Begin to invoke the Add method.
IAsyncResult myAsyncResult = myLogicalMethodInfo.BeginInvoke(
myMathService,new object[]{10,10},myAsyncCallback,null);
// Wait until invoke is complete.
myAsyncResult.AsyncWaitHandle.WaitOne();
// Get the result.
object[] myReturnValue;
myReturnValue = myLogicalMethodInfo.EndInvoke(myMathService,myAsyncResult);
Console.WriteLine("Sum of 10 and 10 is " + myReturnValue[0]);
}
// This method will be called at the end of the asynchronous call.
static void MyEndIntimationMethod(IAsyncResult Result)
{
Console.WriteLine("Asynchronous call on Add method finished.");
}
public:
[PermissionSet(SecurityAction::Demand, Name="FullTrust")]
static void main()
{
// Get the type information.
// Note: The MyMath class is a proxy class generated by the Wsdl.exe
// utility for the Math Web service. This class can also be found in
// the SoapHttpClientProtocol class example.
Type^ myType = MyMath::MyMath::typeid;
// Get the method info.
MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" );
MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" );
// Create an instance of the LogicalMethodInfo class.
array<MethodInfo^>^ temp0 = { myBeginMethod, myEndMethod };
LogicalMethodInfo^ myLogicalMethodInfo =
( LogicalMethodInfo::Create( temp0, LogicalMethodTypes::Async ) )[ 0 ];
// Get an instance of the proxy class.
MyMath::MyMath^ myMathService = gcnew MyMath::MyMath;
// Call the MyEndIntimationMethod method to intimate the end of
// the asynchronous call.
AsyncCallback^ myAsyncCallback = gcnew AsyncCallback( MyEndIntimationMethod );
// Begin to invoke the Add method.
array<Object^>^ temp1 = { 10, 10 };
IAsyncResult^ myAsyncResult = myLogicalMethodInfo->BeginInvoke(
myMathService, temp1, myAsyncCallback, nullptr );
// Wait until invoke is complete.
myAsyncResult->AsyncWaitHandle->WaitOne();
// Get the result.
array<Object^>^ myReturnValue;
myReturnValue = myLogicalMethodInfo->EndInvoke( myMathService, myAsyncResult );
Console::WriteLine( "Sum of 10 and 10 is {0}", myReturnValue[ 0 ] );
}
// This method will be called at the end of the asynchronous call.
static void MyEndIntimationMethod( IAsyncResult^ /*Result*/ )
{
Console::WriteLine( "Asynchronous call on Add method finished." );
}
public static void main(String[] args)
{
// Get the type information.
// Note: The MyMath class is a proxy class generated by the Wsdl.exe
// utility for the Math Web service. This class can also be found in
// the SoapHttpClientProtocol class example.
Type myType = MyMath.MyMath.class.ToType();
// Get the method info.
MethodInfo myBeginMethod = myType.GetMethod("BeginAdd");
MethodInfo myEndMethod = myType.GetMethod("EndAdd");
// Create an instance of the LogicalMethodInfo class.
LogicalMethodInfo myLogicalMethodInfo = (LogicalMethodInfo)(
LogicalMethodInfo.Create(new MethodInfo[] { myBeginMethod,
myEndMethod }, LogicalMethodTypes.Async).get_Item(0));
// Get an instance of the proxy class.
MyMath.MyMath myMathService = new MyMath.MyMath();
// Call the MyEndIntimationMethod method to intimate the end of
// the asynchronous call.
AsyncCallback myAsyncCallback = new AsyncCallback(MyEndIntimationMethod);
// Begin to invoke the Add method.
IAsyncResult myAsyncResult = myLogicalMethodInfo.BeginInvoke(
myMathService, new Object[] { (Int32)10, (Int32)10 },
myAsyncCallback, null);
// Wait until invoke is complete.
myAsyncResult.get_AsyncWaitHandle().WaitOne();
// Get the result.
Object myReturnValue[];
myReturnValue = myLogicalMethodInfo.EndInvoke(myMathService,
myAsyncResult);
Console.WriteLine("Sum of 10 and 10 is " + myReturnValue.get_Item(0));
} //main
// This method will be called at the end of the asynchronous call.
static void MyEndIntimationMethod(IAsyncResult Result)
{
Console.WriteLine("Asynchronous call on Add method finished.");
} //MyEndIntimationMethod
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
LogicalMethodInfo-Klasse
LogicalMethodInfo-Member
System.Web.Services.Protocols-Namespace