cancel
Showing results for 
Search instead for 
Did you mean: 

How to trace a web service call with logger.beDebug()

Former Member
0 Kudos

Hello,

I have been testing consumption of abap web services from java web dynpro.

After developing the web dynpro, adding an adaptive web service model, I've been trying to debug/trace the call to the web service.

When calling the execute method I get an exception that might be related to wrong passed parameters or something else. In the catch scope I've added the trace function preconized but it never enters it as the logger.beDebug() is set to false, how can I set it to true?

Where am I supposed to get the traces? from the E:\usr\sap\JXX\JC00\j2ee\cluster\server0\log\system

on the SAP Engine?

The trace function added is:


  /**
  * Enrich tracing information with exception details on an
  * invoced Web Service
  */
  private void traceWSInvocation(
	WSTypedModelClassExecutable requestMO,
	Exception ex) {
	logger.traceThrowableT(
	Severity.ERROR,
	wdComponentAPI.getApplication().getDeployableObjectPart().getName(),
	ex);
	IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
	msgMgr.reportWarning("Enters the traceWSInvocation scope");
  if (logger.beDebug()) {
	msgMgr.reportWarning("In the logger.beDebug() trace function");
	logger.debugT("Adaptive Web Service call request");
//	 trace Web Service request (header + SOAP request)
	logger.debugT(requestMO.wdGetRequestLog());
//	 trace Web Service response (header + SOAP request)
	logger.debugT("Adaptive Web Service call response");
	logger.debugT(requestMO.wdGetResponseLog());
	logger.debugT(
	requestMO.associatedModelClassInfo().getModelInfo().toString());
//	model object tree in XML format
	logger.debugT(requestMO.toString());
  }
  }

thanks for helping,

Tanguy Mezzano

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Tanguy,

if you want a quick solution just remove the if condition. Be sure to write requestMO.wdSetInvocationLogEnabled(true); before WS execution.

Then just write the xml to the default trace using sth. like System.err.println(requestMO.wdGetRequestLog());

If you want the correct solution try to learn more about logging and tracing. The SDN is full of information on this topic although it is a little tricky to get it to work.

Hope it helps

Matthias

Former Member
0 Kudos

Oh what i forgot:

I suggest accessing the default trace or the logs in general using the standalone log viewer in <drive>\usr\sap\<instance>\JC00\j2ee\admin\logviewer-standalone\logviewer.bat