cancel
Showing results for 
Search instead for 
Did you mean: 

Write XML in a context field

carlos_valentini3
Participant
0 Kudos

Good morning forum

Have to implement the following solution.

In a Web Dynpro component I am consuming a web service, and reading an XML, it is now functioning properly.

But after the XML data is loaded into context, I must record all xml content in a context field.

I implemented the following logic:

Request_ITF_O_S_CONSULTA_CADASTRO requestMO = wdContext.currentRequestWSElement () modelObject (.);

requestMO.wdSetInvocationLogEnabled (true);

String xml = requestMO.wdGetResponseLog ();

However the variable "XML" is blank.

Does anyone have any tips on how to do this?

Accepted Solutions (1)

Accepted Solutions (1)

former_member191044
Active Contributor
0 Kudos

Hi Carlos,

have you even executed the the operation of your WS Model? I can't see that from your code. And ofcourse you have to set the LogEnabled to true before you execute the operation.

Here is some sample with explanations:

Request_NumberToWords requestMO = wdContext.currentRequest_NumberToWordsElement().modelObject();

if (logger.beDebug()) {

  requestMO.wdSetInvocationLogEnabled(true); //switch on logging for this model object

}

try {

  requestMO.execute();

  wdContext.nodeResponse().invalidate(); //update context from model

  } catch(Exception ce) {

  wdComponentAPI.getMessageManager().reportException(ce.getMessage(), false);

  }

logger.debugT(requestMO.wdGetRequestLog()); //request log (HTTP header + SOAP request)

logger.debugT(requestMO.wdGetResponseLog()); //response log (HTTP header + SOAP response)

logger.debugT(requestMO.associatedModelClassInfo().getModelInfo().toString()); //model metadata in XML format

logger.debugT(requestMO.toString()); //model object tree in XML format (= model context node content)

Regards,

Tobias

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

not clear what you are doing.....