on 10-08-2004 9:58 PM
Hi,
can you explain to me, please, the way for create a simple example which calls a RFC function in SAP, with callback issue ? Does it work ?
Before, with .NET Connector 1.0 when i created a new proxy the wizard ask me if i wanted to generate asynchronous methods, and now in version 2.0 how can i do it ?
Thanks
Message was edited by: tafkap
Hello,
In SAP, you will find an example function module names STFC_CONNECTION_BACK that was specially built for demonstrating RFC callback. During the execution of this function module, one or more calls to the function STFC_CONNECTION will be made back to the original RFC client by using the ABAP statements:
CALL FUNCTION "STFC_CONNECTION" DESTINATION "BACK"
...
The RFC client should be aware that the function might invoke callbacks and must implement the required callback functions.
Here is a step-by-step example of building a .NET RFC client that calls the above sample RFC function module with callback using .NET Connector 1.0.3 or 2.0:
1 Create a client proxy with the function STFC_CONNECTION_BACK selected as usual, say SAPProxy1
2 Create a server stub with the function STFC_CONNECTION
selected as usual, say SAPProxy2
3 Implement the server function STFC_CONNECTION:
protected override void Stfc_Connection(
string Requtext,out string Echotext,
out string Resptext)
{
Resptext = "This is function STFC_CONNECTION";
Echotext = Requtext;
Console.WriteLine("Callback get called");
}
4 Call the function module with callback
4.1 Create a SAPClient instance of class SAPProxy1
SAPProxy1 proxy = new SAPProxy1("....");
4.2 Create a SAPServer instance of class SAPProxy2 to be used as callback server
SAPProxy2 callbackServer = new SAPProxy2();
4.3 Set SAPClient's CallbackServer property to the SAPServer instance. This property is newly introduced in SAP .NET Connector 1.0.3 and 2.0
proxy.CallbackServer = callbackServer;
4.4 Call STFC_CONNECTION_BACK and specify the number of callbacks with the first parameter:
prxy.Stfc_Connection_Back("2",
"hello world",out echoText,
out countCallback,out respText);
During the call, the callback function STFC_CONNECTION will be get called twice.
Hope this helps,
Guangwei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Open the *.sapwsdl file in design mode, then right-click the design view and choose properties, to show the properties, if they are not already shown.
There you find the settings for proxy generation known from version 1.
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.