Is there any way to find out if the XMLInputFactory.properties
"javax.xml.stream.isCoalescing=false" is getting overridden. From
StAXUtils.java -> newXMLInputFactory() method, there is no debug line, which
shows what property is getting set. I was able to print the key, value pair
using the following code. ClassLoader is able to find the
XMLInputFactory.properties file but I can still see that CDATA string is not
preserved in the logs.
Please help.
private void classLoaderTest() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL[] urls = ((URLClassLoader) loader).getURLs();
for (int i = 0; i < urls.length; i++) {
System.out.println(urls[i].getFile());
}
InputStream in = loader
.getResourceAsStream("XMLInputFactory.properties");
if (in == null) {
System.out.println ("InputStream instance is null");
} else {
try {
Properties rawProps = new Properties();
rawProps.load(in);
for (Iterator it = rawProps.entrySet().iterator();
it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String strKey = (String) entry.getKey();
System.out.println("Key = " + strKey);
String strValue = (String) entry.getValue();
System.out.println("Value = " + strValue);
}
} catch (IOException ex) {
System.out.println("Failed to read
XMLInputFactory.properties"
+ ex.getMessage());
} finally {
try {
in.close();
} catch (IOException ex) {
// Ignore
}
}
}
}
Logs from Axis2
2012-01-18 11:10:34,558 [main] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter - Creating MTOMXMLStreamWriter
2012-01-18 11:10:34,558 [main] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter - OutputStream =class
org.apache.commons.httpclient.ChunkedOutputStream
2012-01-18 11:10:34,558 [main] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter - OMFormat = OMOutputFormat [
mimeBoundary =null rootContentId=null doOptimize=false doingSWA=false
isSOAP11=false charSetEnc
oding=UTF-8 xmlVersion=null contentType=application/soap+xml
ignoreXmlDeclaration=false autoCloseWriter=false actionProperty=null
optimizedThreshold=0]
2012-01-18 11:10:34,558 [main] DEBUG org.apache.axiom.om.util.StAXUtils -
XMLStreamWriter is
org.apache.axiom.util.stax.dialect.WoodstoxStreamWriterWrapper
2012-01-18 11:10:34,559 [main] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter - Calling
MTOMXMLStreamWriter.flush
2012-01-18 11:10:34,559 [main] DEBUG
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl - Could not close builder or
parser due to:
2012-01-18 11:10:34,559 [main] DEBUG
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl - builder is null
2012-01-18 11:10:34,559 [main] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter - Calling
MTOMXMLStreamWriter.flush
2012-01-18 11:10:34,559 [main] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter - close
2012-01-18 11:10:34,559 [main] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter - end writeTo()
2012-01-18 11:10:34,559 [main] DEBUG httpclient.wire.content - >> "278[\r][\n]"
2012-01-18 11:10:34,560 [main] DEBUG httpclient.wire.content - >> "<?xml
version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveB
yParameter
xmlns:ns1="http://wsdl.echelon.com/Panoramix/"><sKey>d0fa5e6038dc4a3091a590834cd5cc11</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters>&
lt;![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]><
/sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></soapenv:Envelope>"
2012-01-18 11:10:34,560 [main] DEBUG httpclient.wire.content - >> "[\r][\n]"
2012-01-18 11:10:34,560 [main] DEBUG httpclient.wire.content - >> "0"
2012-01-18 11:10:34,560 [main] DEBUG httpclient.wire.content - >> "[\r][\n]"
2012-01-18 11:10:34,560 [main] DEBUG httpclient.wire.content - >> "[\r][\n]"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.engine.Phase -
[MessageContext: logID=30595be678156757ef11ed8648bbd9f877263817d9e8e0fd]
Invoking flowComplete() in Phase "Security"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.engine.Phase -
[MessageContext: logID=30595be678156757ef11ed8648bbd9f877263817d9e8e0fd]
Invoking flowComplete() in Phase "MessageOut"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.engine.Phase -
[MessageContext: logID=30595be678156757ef11ed8648bbd9f877263817d9e8e0fd]
Invoking flowComplete() in Phase "PolicyDetermination"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.engine.Phase -
[MessageContext: logID=30595be678156757ef11ed8648bbd9f877263817d9e8e0fd]
Invoking flowComplete() in Phase "OperationOutPhase"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.engine.Phase -
[MessageContext: logID=30595be678156757ef11ed8648bbd9f877263817d9e8e0fd]
Invoking flowComplete() in Phase "OpPhase"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.engine.Phase -
[MessageContext: logID=30595be678156757ef11ed8648bbd9f877263817d9e8e0fd]
Invoking flowComplete() in Phase "RMPhase"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.client.Options -
getAction (http://wsdl.echelon.com/Panoramix/RetrieveByParameter) from
org.apache.axis2.client.Options@1af61af6
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.context.MessageContext -
Old SoapAction is (http://wsdl.echelon.com/Panoramix/RetrieveByParameter)
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.context.MessageContext -
New SoapAction is (null)
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.client.Options -
setAction Old action is (null)
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.client.Options -
setAction New action is (null)
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.transport.TransportUtils
- createSOAPEnvelope using Builder (class org.apache.axis2.builder.SOAPBuilder)
selected from type (application/soap+xml)
2012-01-18 11:10:34,587 [main] DEBUG httpclient.wire.content - << "<?xm"
2012-01-18 11:10:34,587 [main] DEBUG org.apache.axis2.builder.BuilderUtil -
char set encoding set from default =utf-8
2012-01-18 11:10:34,588 [main] DEBUG httpclient.wire.content - << "l
version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:rpc="http://www.w3.org/2003/05/s
oap-rpc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><RetrieveByParameterResponse
xmlns="http://wsdl.echelon.com/Panoramix/"><RetrieveByParame
terResult
xmlns=""><RETURNS><STATUS>8a27cb8afd464686a3893f4f8db26540</STATUS><APIPAYLOAD
/></RETURNS></RetrieveByParameterResult></RetrieveByParameterResponse></soap:Body></soap:
Envelope>"
2012-01-18 11:10:34,588 [main] DEBUG org.apache.axiom.om.util.StAXUtils -
XMLStreamReader is
org.apache.axiom.util.stax.dialect.WoodstoxStreamReaderWrapper
StAXUtils.java
private static XMLInputFactory newXMLInputFactory(final ClassLoader
classLoader,
final StAXParserConfiguration configuration) {
return (XMLInputFactory)AccessController.doPrivileged(new
PrivilegedAction() {
public Object run() {
ClassLoader savedClassLoader;
if (classLoader == null) {
savedClassLoader = null;
} else {
savedClassLoader =
Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
}
try {
XMLInputFactory factory = XMLInputFactory.newInstance();
// Woodstox by default creates coalescing parsers. Even if
this violates
// the StAX specs, for compatibility with Woodstox, we
always enable the
// coalescing mode. Note that we need to do that before
loading
// XMLInputFactory.properties so that this setting can be
overridden.
factory.setProperty(XMLInputFactory.IS_COALESCING,
Boolean.TRUE);
Map props =
loadFactoryProperties("XMLInputFactory.properties");
if (props != null) {
for (Iterator it = props.entrySet().iterator();
it.hasNext(); ) {
Map.Entry entry = (Map.Entry)it.next();
factory.setProperty((String)entry.getKey(),
entry.getValue());
}
}
StAXDialect dialect =
StAXDialectDetector.getDialect(factory.getClass());
if (configuration != null) {
factory = configuration.configure(factory, dialect);
}
return new ImmutableXMLInputFactory(dialect.normalize(
dialect.makeThreadSafe(factory)));
} finally {
if (savedClassLoader != null) {
Thread.currentThread().setContextClassLoader(savedClassLoader);
}
}
}
});