cancel
Showing results for 
Search instead for 
Did you mean: 

Ping functionality for backend in webdynpro

Former Member
0 Kudos

Hello Everybody,

I want to check whether my SAP R/3 system is up and running or not before calling any RFC from webdynpro or any other J2EE applications.

For that whether any fuctionality like ping is available in WAS 6.40?

Also i want to know what all exceptions can occur when calling any RFC, so that i can write code in advance for all those exceptions and take proper actions against them.

I am waiting for reply.Please reply as soon as possible its very urgent.

Thanks,

Bhavik Devisha

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello all,

I didn't get answer for this question?

I want to know whether it is possible or not.

If yes, then how can we do that.

Regards,

Bhavik

former_member182372
Active Contributor
0 Kudos

Hello,

why don`t you like JCO.Client.ping() method? Or, you can use same approach like in Dynpro content administrator:

  public void onActionTestConnection(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionTestConnection(ServerEvent)

		String name = wdContext.currentJCOClientsElement().getName();

		IWDMessageManager msgMgr = wdThis.wdGetAPI().getComponent().getMessageManager();

		try {
			IWDJCOClientConnection connection = WDSystemLandscape.getJCOClientConnection(name, null);

			// Ping ...
			JCO.Client client = connection.getClient();
			client.ping();

			// Create a new repository
			IRepository repository = JCO.createRepository("MYRepository", client);

			// Check used user
			JCO.Function func = repository.getFunctionTemplate("USER_NAME_GET").getFunction();
			client.execute(func);
			String userID = (String) func.getExportParameterList().getValue("USER_NAME");

			// Release the client into the pool
			connection.release();
			msgMgr.reportSuccess("JCo destination '" + name + "' was sucessfully tested with user '" + userID + "'");

		} catch (Exception e) {
			msgMgr.reportException(e.toString(), true);
		}
    //@@end
  }

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maksim,

What is JCOClients node here?

What is the value under name string?

If i have two JCO destinations, modeldata and metadata, then how can i ping server based on this connections?

Regards,

Bhavik

former_member182372
Active Contributor
0 Kudos

Hello Bhavik,

> What is JCOClients node here?

Sorry, don`t really know details. I just checked sources of component.

> What is the value under name string?

I think it is name of JCo destination (e.g. WD_RFC_METADATA_DEST, WD_MODELDATA_DEST)

> If i have two JCO destinations, modeldata and

> metadata, then how can i ping server based on this

> connections?

If you are using adaptive RFC model you can get JCo.Client from model. Or you can pass name of JCo destinations to WDSystemLandscape.getJCOClientConnection.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maksim,

Thaks for your kind help.

I have one more question. We can check using this ping functionality that server is running or not.

But, this code will help to Modeldata connections only. But, if some error oddurs for Metadata connection, then how can we catch that exception in our webdynpro application?

It thorws error before executing our code.

Regards,

Bhavik

former_member182372
Active Contributor
0 Kudos

Hi Bhavik,

For me 2 options seems to be a workaround:

1) Try to find a place which is called before throwing exception and call check there. Try to set breakpoints in wdInit and constructor of componentController for example.

2) Create another component which has no dependecies to model and check backend availability there and after navigate to component with dependecies.

Best regards, Maksim R.