cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert xmlpayload content into string using java

Former Member
0 Kudos

hi,

will the following statement get the xmlpayload content as string.

XMLPayload xmlpayload = msg.getDocument();

String xmltxt = msg.getDocument().getText().toString();

will the xmltxt contains the payload as string.

answers will be rewarded.

Regards,

Shanthakumar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Shanthakumar,

Try this:

public ModuleData process(ModuleContext moduleContext,ModuleData inputModuleData)throws ModuleException {

Object obj = null;

Message msg = null;

ModuleException mEx = null;

AuditMessageKey amk = null;

String givenText = "";

try{

obj = inputModuleData.getPrincipalData();

msg = (Message)obj;

amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);

XMLPayload inputpayload = msg.getDocument() ;

givenText = new String(inputpayload.getText().toString());

}

catch(Exception e){

throw mEx = new ModuleException("Error while creating basic instances obj,msg,xmlplayload,text");

}

}

Thanks,

Varun

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

go thro this

Regards

raj