cancel
Showing results for 
Search instead for 
Did you mean: 

Concurrent Access in Web Services (How to handle SAP connection)

0 Kudos

Hi, I am currently using SAP NCO 3.0 in one of our Web Services.

Whenever a call is initiate, the code will do RegisterDestinationConfiguration(cfg) and UnregisterDestinationConfiguration(cfg) after all bapi invoke process is completed. All web service call will be using the same cfg and destionation (RfcDestinationManager.GetDestination("SAP") where SAP is just a dummy since all webservices will use the same account).

By doing this, im getting error below when i try to unregister destination config

Error: SAP.Middleware.Connector.RfcInvalidStateException: Cannot unregister the given destination configuration

My guess: The config was unregisterd by other web services called.

Question: Is there a way to handle this unregister/register destination config better?

Accepted Solutions (1)

Accepted Solutions (1)

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert

Hello Li,

> Whenever a call is initiate, the code will do RegisterDestinationConfiguration(cfg) and
> UnregisterDestinationConfiguration(cfg) after all bapi invoke process is completed.

Why do you do that? This is completely unnecessary. A destination configuration should only be registered once at the startup of your program (web application) and can remain active for as long as that web server runs! Then you don't have any problems with race conditions between parallel web sessions. That should solve that problem easily.

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

A IDestinationConfiguration can manage many concrete destinations. It's so to say the database for all known destinations.

Best regards,
Markus

0 Kudos

Hi Ulrich, you are right. I should just registered once at the startup of my program. Problem resolve. Thanks !

Answers (0)