29 August 2012

How to retrieve XML sent into SOAP Payload

Using WebLogic Server 10.3.5 , we need a way to retrieve XML payload that is not sent between CDATA:


To implement the solution, please use the following snippet code to achieve the requirement:

To achieve this, we use JAX-RPC and following webservice endpoint:
in the method nodeToString() we are getting the XML as String:


public String sayHello(javax.xml.soap.SOAPElement message) {


System.out.println("sayHello:" + message.toString());

System.out.println("sayHello:" + message.getClass());


String xml_str = nodeToString(message);




return "Here is the message: '" + message + "'";


private String nodeToString(Node node) {

StringWriter sw = new StringWriter();

try {

System.out.println("Start string conversion...");

Transformer t = TransformerFactory.newInstance().newTransformer();

t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

t.transform(new DOMSource(node), new StreamResult(sw));

} catch (TransformerException te) {

System.out.println("nodeToString Transformer Exception");


System.out.println("end string conversion...");

return sw.toString();


There is a workaround escaping the XML with CDATA or XML entities < >
but the solution would be to use javax.xml.soap.SOAPElement as parameter of the webservice endpoint

28 August 2012

Numbers with Thousand Separators

My solution for Numbers with Thousand Separators regexp:


My Blog List

Blog Archive


The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.