cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Smyth <andrea.sm...@iona.com>
Subject SequenceTest failing with NAMESPACE_ERR: An attempt is made to create or change ...
Date Tue, 07 Nov 2006 17:39:58 GMT
It looks like this is a bug in the JDK - same or similar 
to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6467808 - I have a 
very simple test case  which fails when run with JDK 1.5.0_09 but passes 
with JDK 1.5.0_06.
When the child elements of the Header element are removed, things work 
fine with JDK 1.5.0_09 also.
Jervis, how did you work around the problem in the 
SOAPHandlerInterceptor/SOAPMessageContextImpl earlier?

Andrea.

---
SoapMessageFactoryTest.java: (in separate project with dependencies on 
saaj-impl. saaj-api activation and junit only)
package org.apache.cxf.jdkbug;

import java.io.InputStream;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;

import junit.framework.TestCase;

public class SoapMessageFactoryTest extends TestCase {

    public void testBuildSoapMessage() throws Exception {
        InputStream is = 
SoapMessageFactoryTest.class.getResourceAsStream("msg4.xml");
        MessageFactory mf = MessageFactory.newInstance();
        SOAPMessage sm = mf.createMessage(null, is);
        SOAPEnvelope env = sm.getSOAPPart().getEnvelope();
        assertNotNull(env);
    }
}

msg4.xml:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm">
    <wsa:MessageID 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">urn:uuid:32dd41e4-fe14-4603-9cee-e918f8d8a346</wsa:MessageID>
    <wsa:To 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://localhost:9020/SoapContext/GreeterPort</wsa:To>
    <wsa:ReplyTo 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
      <wsa:Address 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/none</wsa:Address>
    </wsa:ReplyTo>
    <wsa:Action 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"></wsa:Action>
    <wsrm:Sequence xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm">
      <wsrm:Identifier 
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm">urn:uuid:b17e5276-32b1-4c18-bc07-bdea1771b951</wsrm:Identifier>
      <wsrm:MessageNumber 
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm">3</wsrm:MessageNumber>
    </wsrm:Sequence>
  </soap:Header>
  <soap:Body>
    <greetMeOneWay xmlns:ns2="http://www.w3.org/2005/08/addressing/wsdl" 
xmlns="http://cxf.apache.org/greeter_control/types"><requestType>thrice</requestType></greetMeOneWay>
  </soap:Body>
</soap:Envelope>

StackTrace:
ERROR:  'NAMESPACE_ERR: An attempt is made to create or change an object 
in a way which is incorrect with regard to namespaces.'
[surefire] Running org.apache.cxf.jdkbug.SoapMessageFactoryTest
[surefire] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.191 sec
[surefire]
[surefire] 
testBuildSoapMessage(org.apache.cxf.jdkbug.SoapMessageFactoryTest)  Time 
elapsed: 0.171 sec  <<< ERROR!
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope 
from given source:
    at 
com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:114)
    at 
com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:71)
    at 
com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:125)
    at 
org.apache.cxf.jdkbug.SoapMessageFactoryTest.testBuildSoapMessage(SoapMessageFactoryTest.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at 
org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:242)
    at 
org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBattery.java:216)
    at org.apache.maven.surefire.Surefire.executeBattery(Surefire.java:215)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:163)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:87)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at 
org.apache.maven.surefire.SurefireBooter.main(SurefireBooter.java:785)
Caused by: javax.xml.transform.TransformerException: 
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or 
change an object in a way which is incorrect with regard to namespaces.
    at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:651)
    at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)
    at 
com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer.transform(EfficientStreamingTransformer.java:390)
    at 
com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:102)
    ... 30 more
Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made 
to create or change an object in a way which is incorrect with regard to 
namespaces.
    at 
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.checkDOMNSErr(CoreDocumentImpl.java:2421)
    at 
com.sun.org.apache.xerces.internal.dom.AttrNSImpl.setName(AttrNSImpl.java:150)
    at 
com.sun.org.apache.xerces.internal.dom.AttrNSImpl.<init>(AttrNSImpl.java:111)
    at 
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createAttributeNS(CoreDocumentImpl.java:2012)
    at 
com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.createAttributeNS(SOAPDocumentImpl.java:161)
    at 
com.sun.org.apache.xerces.internal.dom.ElementImpl.setAttributeNS(ElementImpl.java:684)
    at 
com.sun.xml.messaging.saaj.soap.impl.ElementImpl.setAttributeNS(ElementImpl.java:1213)
    at 
com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.startElement(SAX2DOM.java:134)
    at 
com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:205)
    at 
com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.characters(ToXMLSAXHandler.java:524)
    at org.xml.sax.helpers.XMLFilterImpl.characters(XMLFilterImpl.java:564)
    at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.characters(AbstractSAXParser.java:570)
    at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanContent(XMLDocumentFragmentScannerImpl.java:1062)
    at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1649)
    at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
    at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    at 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
    at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
    at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:588)
    at 
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:642)
    ... 33 more

Mime
View raw message