[jira] Commented: (SM-722) ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes
[ https://issues.apache.org/activemq/browse/SM-722?page=comments#action_37290 ] Guillaume Nodet commented on SM-722: I don't think the problem comes from here. I would rather take a look at the SourceTransformer#createDocumentBuilderFactory method which has the following code: {code:lang=java,title=org.apache.servicemix.jbi.jaxp.SourceTransformer} public DocumentBuilderFactory createDocumentBuilderFactory() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setIgnoringElementContentWhitespace(true); factory.setIgnoringComments(true); return factory; } {code} ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes - Key: SM-722 URL: https://issues.apache.org/activemq/browse/SM-722 Project: ServiceMix Issue Type: Bug Components: servicemix-core Affects Versions: 3.0 Reporter: Renaud Bruyeron Fix For: 3.0.1 The problem is in the code below in ExtendedXMLStreamReader, which is used by SoapMarshaler to extract the SOAP message from a http invocation, and put it in a NormalizedMessage. I have a SOAP message that has things like this: text /text. The whitespace is significant, and should not be trimmed, yet the message comes out as text/. Is there a reason for explicitely doing this? public int nextTag() throws XMLStreamException { int eventType = next(); while((eventType == XMLStreamConstants.CHARACTERS isWhiteSpace()) // skip whitespace || (eventType == XMLStreamConstants.CDATA isWhiteSpace()) // skip whitespace || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT ) { eventType = next(); } if (eventType != XMLStreamConstants.START_ELEMENT eventType != XMLStreamConstants.END_ELEMENT) { throw new XMLStreamException(expected start or end tag, getLocation()); } return eventType; } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (SM-722) ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes
[ https://issues.apache.org/activemq/browse/SM-722?page=comments#action_37291 ] Guillaume Nodet commented on SM-722: I don't think the problem comes from here. I would rather take a look at the SourceTransformer#createDocumentBuilderFactory method which has the following code: {code:lang=java|title=org.apache.servicemix.jbi.jaxp.SourceTransformer} public DocumentBuilderFactory createDocumentBuilderFactory() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setIgnoringElementContentWhitespace(true); factory.setIgnoringComments(true); return factory; } {code} Could you try removing the setIgnoringXxx calls and see if it changes ? ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes - Key: SM-722 URL: https://issues.apache.org/activemq/browse/SM-722 Project: ServiceMix Issue Type: Bug Components: servicemix-core Affects Versions: 3.0 Reporter: Renaud Bruyeron Fix For: 3.0.1 The problem is in the code below in ExtendedXMLStreamReader, which is used by SoapMarshaler to extract the SOAP message from a http invocation, and put it in a NormalizedMessage. I have a SOAP message that has things like this: text /text. The whitespace is significant, and should not be trimmed, yet the message comes out as text/. Is there a reason for explicitely doing this? public int nextTag() throws XMLStreamException { int eventType = next(); while((eventType == XMLStreamConstants.CHARACTERS isWhiteSpace()) // skip whitespace || (eventType == XMLStreamConstants.CDATA isWhiteSpace()) // skip whitespace || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT ) { eventType = next(); } if (eventType != XMLStreamConstants.START_ELEMENT eventType != XMLStreamConstants.END_ELEMENT) { throw new XMLStreamException(expected start or end tag, getLocation()); } return eventType; } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (SM-722) ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes
[ https://issues.apache.org/activemq/browse/SM-722?page=comments#action_37293 ] Renaud Bruyeron commented on SM-722: mmhh, I am not sure the ConsumerProcessor is using a sourceTransformer to parse the incoming SOAP message: {code:java|title=org.apache.servicemix.http.processors.ConsumerProcessor} SoapMessage message = soapHelper.getSoapMarshaler().createReader().read( request.getInputStream(), request.getHeader(Constants.HEADER_CONTENT_TYPE)); {code} In my case, the SoapReader uses the readSoapUsingStax(...) method. The relevant code is: {code:title=org.apache.servicemix.soap.marshalers.SoapReader line 187} private SoapMessage readSoapUsingStax(InputStream is) throws Exception { SoapMessage message = new SoapMessage(); XMLStreamReader reader = marshaler.getInputFactory().createXMLStreamReader(is); reader = new ExtendedXMLStreamReader(reader); // skipping... // Create Source for content if (reader.nextTag() != XMLStreamConstants.END_ELEMENT) { QName childName = reader.getName(); message.setBodyName(childName); // Check for fault if (childName.equals(new QName(soapUri, SoapMarshaler.FAULT))) { message.setFault(readFaultUsingStax(reader)); } else { message.setSource(new StaxSource(new FragmentStreamReader(reader))); } } {code} As you can see, it is using the ExtendedXMLStreamReader to wrap the reader, therefore whitespace-only nodes get trimmed. By the way in DOM mode, the SoapReader uses the DocumentBuilderFactory directly: {code:title=org.apache.servicemix.soap.marshalers.SoapReader line 91} private SoapMessage readSoapUsingDom(InputStream is) throws Exception { SoapMessage message = new SoapMessage(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); Document doc = factory.newDocumentBuilder().parse(is); {code} ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes - Key: SM-722 URL: https://issues.apache.org/activemq/browse/SM-722 Project: ServiceMix Issue Type: Bug Components: servicemix-core Affects Versions: 3.0 Reporter: Renaud Bruyeron Fix For: 3.0.1 The problem is in the code below in ExtendedXMLStreamReader, which is used by SoapMarshaler to extract the SOAP message from a http invocation, and put it in a NormalizedMessage. I have a SOAP message that has things like this: text /text. The whitespace is significant, and should not be trimmed, yet the message comes out as text/. Is there a reason for explicitely doing this? public int nextTag() throws XMLStreamException { int eventType = next(); while((eventType == XMLStreamConstants.CHARACTERS isWhiteSpace()) // skip whitespace || (eventType == XMLStreamConstants.CDATA isWhiteSpace()) // skip whitespace || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT ) { eventType = next(); } if (eventType != XMLStreamConstants.START_ELEMENT eventType != XMLStreamConstants.END_ELEMENT) { throw new XMLStreamException(expected start or end tag, getLocation()); } return eventType; } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (SM-722) ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes
[ https://issues.apache.org/activemq/browse/SM-722?page=comments#action_37286 ] Renaud Bruyeron commented on SM-722: Sorry about this mess, I think jira saw something special in the code :) Here's the code again: {code:title=org.apache.servicemix.jbi.jaxp.ExtendedXMLStreamReader} public int nextTag() throws XMLStreamException { int eventType = next(); while((eventType == XMLStreamConstants.CHARACTERS isWhiteSpace()) // skip whitespace || (eventType == XMLStreamConstants.CDATA isWhiteSpace()) // skip whitespace || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT ) { eventType = next(); } if (eventType != XMLStreamConstants.START_ELEMENT eventType != XMLStreamConstants.END_ELEMENT) { throw new XMLStreamException(expected start or end tag, getLocation()); } return eventType; } {code} ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes - Key: SM-722 URL: https://issues.apache.org/activemq/browse/SM-722 Project: ServiceMix Issue Type: Bug Components: servicemix-core Affects Versions: 3.0 Reporter: Renaud Bruyeron Fix For: 3.0.1 The problem is in the code below in ExtendedXMLStreamReader, which is used by SoapMarshaler to extract the SOAP message from a http invocation, and put it in a NormalizedMessage. I have a SOAP message that has things like this: text /text. The whitespace is significant, and should not be trimmed, yet the message comes out as text/. Is there a reason for explicitely doing this? public int nextTag() throws XMLStreamException { int eventType = next(); while((eventType == XMLStreamConstants.CHARACTERS isWhiteSpace()) // skip whitespace || (eventType == XMLStreamConstants.CDATA isWhiteSpace()) // skip whitespace || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT ) { eventType = next(); } if (eventType != XMLStreamConstants.START_ELEMENT eventType != XMLStreamConstants.END_ELEMENT) { throw new XMLStreamException(expected start or end tag, getLocation()); } return eventType; } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (SM-722) ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes
[ https://issues.apache.org/activemq/browse/SM-722?page=comments#action_37295 ] Guillaume Nodet commented on SM-722: Them the problem may come from the StaxSource class. The code for the nextTag is good, as it is supposed to skip events to the next start / end tag. However, the StaxSource does not send any events for entities, spaces... It should be easy to fix if you have a simple junit test case. ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes - Key: SM-722 URL: https://issues.apache.org/activemq/browse/SM-722 Project: ServiceMix Issue Type: Bug Components: servicemix-core Affects Versions: 3.0 Reporter: Renaud Bruyeron Fix For: 3.0.1 The problem is in the code below in ExtendedXMLStreamReader, which is used by SoapMarshaler to extract the SOAP message from a http invocation, and put it in a NormalizedMessage. I have a SOAP message that has things like this: text /text. The whitespace is significant, and should not be trimmed, yet the message comes out as text/. Is there a reason for explicitely doing this? public int nextTag() throws XMLStreamException { int eventType = next(); while((eventType == XMLStreamConstants.CHARACTERS isWhiteSpace()) // skip whitespace || (eventType == XMLStreamConstants.CDATA isWhiteSpace()) // skip whitespace || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION || eventType == XMLStreamConstants.COMMENT ) { eventType = next(); } if (eventType != XMLStreamConstants.START_ELEMENT eventType != XMLStreamConstants.END_ELEMENT) { throw new XMLStreamException(expected start or end tag, getLocation()); } return eventType; } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira