cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <daniel.k...@iona.com>
Subject Re: svn commit: r471449 - in /incubator/cxf/trunk/rt/frontend/jaxws/src: main/java/org/apache/cxf/jaxws/handler/soap/ test/java/org/apache/cxf/jaxws/handler/soap/ test/java/org/apache/cxf/jaxws/handler/soap/resources/
Date Mon, 06 Nov 2006 03:34:40 GMT


Jervis,

These tests don't pass on my machine.  Linux, JDk 1.5.0_08.

Can you look into it?

Thanks!
Dan



ERROR:  'NAMESPACE_ERR: An attempt is made to create or change an object 
in a way which is incorrect with regard to namespaces.'
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.jaxws.handler.soap.SOAPHandlerInterceptorTest
[surefire] Tests run: 6, Failures: 0, Errors: 2, Time elapsed: 0.525 sec
[surefire]
[surefire] 
testChangeSOAPHeaderInBound(org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptorTest)
 
Time elapsed: 0.192 sec  <<< ERROR!
org.apache.cxf.binding.soap.SoapFault: SOAPHandlerInterceptor exception
        at 
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:177)
        at 
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptorTest.testChangeSOAPHeaderInBound(SOAPHandlerInterceptorTest.java:288)
        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: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,38]
        at 
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:628)
        at 
com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2021)
        at 
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1927)
        at 
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1054)
        at 
com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1080)
        at 
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:156)
        ... 28 more

[surefire] 
testGetSOAPMessageInBound(org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptorTest)  
Time elapsed: 0.003 sec  <<< ERROR!
org.apache.cxf.binding.soap.SoapFault: SOAPHandlerInterceptor exception
        at 
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:173)
        at 
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptorTest.testGetSOAPMessageInBound(SOAPHandlerInterceptorTest.java:434)
        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: 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 
com.sun.xml.messaging.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.java:1237)
        at 
org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:147)
        ... 28 more
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)
        ... 32 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.ToSAXHandler.flushPending(ToSAXHandler.java:291)
        at 
com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAXHandler.java:349)
        at 
com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAXHandler.java:319)
        at 
org.xml.sax.helpers.XMLFilterImpl.startPrefixMapping(XMLFilterImpl.java:490)
        at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startNamespaceMapping(AbstractSAXParser.java:2063)
        at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:499)
        at 
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
        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)
        ... 35 more




On Sunday November 05 2006 10:51 am, jliu@apache.org wrote:
> Author: jliu
> Date: Sun Nov  5 07:51:22 2006
> New Revision: 471449
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=471449
> Log:
> * Read and modify SOAPHeader both inbound and outbound.
>
> Added:
>    
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/resources/greetMeRpcLitRespWithHeader.xml   (with props)
> Modified:
>    
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptor.java
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptorTest.java
>
> Modified:
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptor.java URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/
>main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?
>view=diff&rev=471449&r1=471448&r2=471449
> =======================================================================
>======= ---
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptor.java (original) +++
> incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptor.java Sun Nov  5 07:51:22 2006 @@
> -39,6 +39,8 @@
>  import javax.xml.ws.handler.MessageContext;
>  import javax.xml.ws.handler.soap.SOAPHandler;
>
> +import org.w3c.dom.Element;
> +
>  import org.apache.cxf.binding.soap.SoapFault;
>  import org.apache.cxf.binding.soap.SoapMessage;
>  import org.apache.cxf.binding.soap.interceptor.SoapInterceptor;
> @@ -156,6 +158,13 @@
>                  }
>                  reader.next();
>                  message.setContent(XMLStreamReader.class, reader);
> +
> +                //replace header element if necessary
> +                if (message.hasHeaders(Element.class)) {
> +                    Element headerElements =
> message.getHeaders(Element.class); +                    headerElements
> = soapMessage.getSOAPHeader(); +                   
> message.setHeaders(Element.class, headerElements); +                }
>              } catch (IOException ioe) {
>                  throw new SoapFault(new
> org.apache.cxf.common.i18n.Message( "SOAPHANDLERINTERCEPTOR_EXCEPTION",
> BUNDLE), ioe,
>
> Modified:
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptorTest.java URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/
>test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.j
>ava?view=diff&rev=471449&r1=471448&r2=471449
> =======================================================================
>======= ---
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptorTest.java (original) +++
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/SOAPHandlerInterceptorTest.java Sun Nov  5 07:51:22 2006
> @@ -22,7 +22,6 @@
>  import java.io.IOException;
>  import java.io.InputStream;
>  import java.io.OutputStream;
> -// import java.io.PrintStream;
>  import java.util.ArrayList;
>  import java.util.HashSet;
>  import java.util.Iterator;
> @@ -108,14 +107,10 @@
>          IMocksControl control = createNiceControl();
>          Binding binding = control.createMock(Binding.class);
>          Exchange exchange = control.createMock(Exchange.class);
> -        SoapMessage message = new SoapMessage(new MessageImpl());
> -        message.setExchange(exchange);
> -
> -        XMLStreamReader reader =
> preparemXMLStreamReader("resources/greetMeRpcLitReq.xml"); -       
> message.setContent(XMLStreamReader.class, reader);
> -
>         
> expect(exchange.get(HandlerChainInvoker.class)).andReturn(invoker).anyT
>imes(); -        // This is to set direction to inbound
> +        SoapMessage message = new SoapMessage(new MessageImpl());
> +        message.setExchange(exchange);
> +        // This is to set direction to outbound
>         
> expect(exchange.getOutMessage()).andReturn(message).anyTimes();
> CachedStream originalEmptyOs = new CachedStream();
>          message.setContent(OutputStream.class, originalEmptyOs);
> @@ -153,7 +148,7 @@
>      // SAAJ tree is created on if SOAPMessageContext.getMessage() is
>      // called. Any changes to SOAPMessage should be streamed back to
>      // outputStream
> -    public void xtestSOAPBodyChangedOutBound() throws Exception {
> +    public void testChangeSOAPBodyOutBound() throws Exception {
>          List<Handler> list = new ArrayList<Handler>();
>          list.add(new SOAPHandler<SOAPMessageContext>() {
>              public boolean handleMessage(SOAPMessageContext smc) {
> @@ -185,14 +180,10 @@
>          IMocksControl control = createNiceControl();
>          Binding binding = control.createMock(Binding.class);
>          Exchange exchange = control.createMock(Exchange.class);
> +       
> expect(exchange.get(HandlerChainInvoker.class)).andReturn(invoker).anyT
>imes(); SoapMessage message = new SoapMessage(new MessageImpl());
> message.setExchange(exchange);
> -
> -        XMLStreamReader reader =
> preparemXMLStreamReader("resources/greetMeRpcLitReq.xml"); -       
> message.setContent(XMLStreamReader.class, reader);
> -
> -       
> expect(exchange.get(HandlerChainInvoker.class)).andReturn(invoker).anyT
>imes(); -        // This is to set direction to inbound
> +        // This is to set direction to outbound
>         
> expect(exchange.getOutMessage()).andReturn(message).anyTimes();
> CachedStream originalEmptyOs = new CachedStream();
>          message.setContent(OutputStream.class, originalEmptyOs);
> @@ -238,23 +229,26 @@
>          NodeList elem3NodeList = outElement
>             
> .getElementsByTagNameNS("http://apache.org/hello_world_rpclit/types",
> "elem3"); Node elem3Element = elem3NodeList.item(0);
> -        assertNotNull("100", elem3Element.getTextContent());
> +        assertEquals("100", elem3Element.getTextContent());
>      }
>
> -    public void xtestGetSOAPHeaderInBound() throws Exception {
> +    public void testChangeSOAPHeaderInBound() throws Exception {
>          List<Handler> list = new ArrayList<Handler>();
>          list.add(new SOAPHandler<SOAPMessageContext>() {
>              public boolean handleMessage(SOAPMessageContext smc) {
>                  try {
> -                    // change mustUnderstand to false
> -                    SOAPMessage message = smc.getMessage();
> -                    SOAPHeader soapHeader = message.getSOAPHeader();
> -                    Iterator it = soapHeader.getChildElements();
> -                    SOAPHeaderElement headerElementNew =
> (SOAPHeaderElement)it.next(); -
> -                    SoapVersion soapVersion = Soap11.getInstance();
> -                   
> headerElementNew.setAttributeNS(soapVersion.getNamespace(),
> "SOAP-ENV:mustUnderstand", -                                           
>         "false"); +                    Boolean outboundProperty =
> (Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); +          
>          if (!outboundProperty.booleanValue()) {
> +                        // change mustUnderstand to false
> +                        SOAPMessage message = smc.getMessage();
> +                        SOAPHeader soapHeader =
> message.getSOAPHeader(); +                        Iterator it =
> soapHeader.getChildElements(); +                       
> SOAPHeaderElement headerElementNew = (SOAPHeaderElement)it.next(); +
> +                        SoapVersion soapVersion =
> Soap11.getInstance(); +                       
> headerElementNew.setAttributeNS(soapVersion.getNamespace(), +          
>                                              "SOAP-ENV:mustUnderstand",
> "false"); +                    }
>                  } catch (Exception e) {
>                      throw new Fault(e);
>                  }
> @@ -280,17 +274,14 @@
>         
> expect(exchange.get(HandlerChainInvoker.class)).andReturn(invoker).anyT
>imes(); // This is to set direction to inbound
>          expect(exchange.getOutMessage()).andReturn(null);
> -
>          SoapMessage message = new SoapMessage(new MessageImpl());
>          message.setExchange(exchange);
> -
>          XMLStreamReader reader =
> preparemXMLStreamReader("resources/greetMeRpcLitReq.xml");
> message.setContent(XMLStreamReader.class, reader);
>          Element headerElement = preparemSOAPHeader();
>          message.setHeaders(Element.class, headerElement);
>          message.put(Element.class, headerElement);
>
> -        // message.setContent(Element.class, preparemSOAPHeader());
>          control.replay();
>
>          SOAPHandlerInterceptor li = new
> SOAPHandlerInterceptor(binding); @@ -299,20 +290,108 @@
>
>          // Verify SOAPMessage header
>          SOAPMessage soapMessageNew =
> message.getContent(SOAPMessage.class); -
>          SOAPHeader soapHeader = soapMessageNew.getSOAPHeader();
>          Iterator itNew = soapHeader.getChildElements();
>          SOAPHeaderElement headerElementNew =
> (SOAPHeaderElement)itNew.next(); SoapVersion soapVersion =
> Soap11.getInstance();
>          assertEquals("false",
> headerElementNew.getAttributeNS(soapVersion.getNamespace(),
> "mustUnderstand"));
>
> -        // Verify the XMLStreamReader
> +        // Verify XMLStreamReader
>          XMLStreamReader xmlReader =
> message.getContent(XMLStreamReader.class); QName qn =
> xmlReader.getName();
>          assertEquals("sendReceiveData", qn.getLocalPart());
> +
> +        // Verify Header Element
> +        Element element = message.getHeaders(Element.class);
> +        NodeList headerNodeList = element.getElementsByTagNameNS(
> +            "http://apache.org/hello_world_rpclit/types", "header1");
> +        Element headerElementNew1 = (Element)headerNodeList.item(0);
> +        assertEquals("false",
> headerElementNew1.getAttributeNS(soapVersion.getNamespace(),
> "mustUnderstand")); +    }
> +
> +    public void testChangeSOAPHeaderOutBound() throws Exception {
> +        List<Handler> list = new ArrayList<Handler>();
> +        list.add(new SOAPHandler<SOAPMessageContext>() {
> +            public boolean handleMessage(SOAPMessageContext smc) {
> +                try {
> +                    Boolean outboundProperty =
> (Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); +          
>          if (outboundProperty.booleanValue()) {
> +                        // change mustUnderstand to false
> +                        SOAPMessage message = smc.getMessage();
> +
> +                        SOAPHeader soapHeader =
> message.getSOAPHeader(); +                        Iterator it =
> soapHeader.getChildElements(new QName( +                           
> "http://apache.org/hello_world_rpclit/types", "header1")); +           
>             SOAPHeaderElement headerElementNew =
> (SOAPHeaderElement)it.next(); +
> +                        SoapVersion soapVersion =
> Soap11.getInstance(); +                       
> headerElementNew.setAttributeNS(soapVersion.getNamespace(), +          
>                                              "SOAP-ENV:mustUnderstand",
> "false"); +                    }
> +                } catch (Exception e) {
> +                    throw new Fault(e);
> +                }
> +                return true;
> +            }
> +
> +            public boolean handleFault(SOAPMessageContext smc) {
> +                return true;
> +            }
> +
> +            public Set<QName> getHeaders() {
> +                return null;
> +            }
> +
> +            public void close(MessageContext messageContext) {
> +            }
> +        });
> +        HandlerChainInvoker invoker = new HandlerChainInvoker(list);
> +
> +        IMocksControl control = createNiceControl();
> +        Binding binding = control.createMock(Binding.class);
> +        Exchange exchange = control.createMock(Exchange.class);
> +       
> expect(exchange.get(HandlerChainInvoker.class)).andReturn(invoker).anyT
>imes(); +        SoapMessage message = new SoapMessage(new
> MessageImpl()); +        message.setExchange(exchange);
> +        // This is to set direction to outbound
> +       
> expect(exchange.getOutMessage()).andReturn(message).anyTimes(); +      
>  CachedStream originalEmptyOs = new CachedStream();
> +        message.setContent(OutputStream.class, originalEmptyOs);
> +
> +        InterceptorChain chain = new PhaseInterceptorChain((new
> PhaseManagerImpl()).getOutPhases()); +        // This is to simulate
> interceptors followed by SOAPHandlerInterceptor +        // write
> outputStream
> +        chain.add(new
> AbstractProtocolHandlerInterceptor<SoapMessage>(binding) { +           
> public void handleMessage(SoapMessage message) throws Fault { +        
>        try {
> +                    CachedStream os = prepareOutputStreamFromResource(
> +                        "resources/greetMeRpcLitRespWithHeader.xml");
> +                    message.setContent(OutputStream.class, os);
> +                } catch (Exception e) {
> +                    // do nothing
> +                }
> +            }
> +
> +        });
> +        message.setInterceptorChain(chain);
> +        control.replay();
> +
> +        SOAPHandlerInterceptor li = new
> SOAPHandlerInterceptor(binding); +        li.handleMessage(message);
> +        control.verify();
> +
> +        // Verify SOAPMessage header
> +        SOAPMessage soapMessageNew =
> message.getContent(SOAPMessage.class); +
> +        SOAPHeader soapHeader = soapMessageNew.getSOAPHeader();
> +        Iterator itNew = soapHeader.getChildElements(new
> QName("http://apache.org/hello_world_rpclit/types", +           
> "header1"));
> +        SOAPHeaderElement headerElementNew =
> (SOAPHeaderElement)itNew.next(); +        SoapVersion soapVersion =
> Soap11.getInstance();
> +        assertEquals("false",
> headerElementNew.getAttributeNS(soapVersion.getNamespace(),
> "mustUnderstand")); }
>
> -    public void xtestGetSOAPMessageInBound() throws Exception {
> +    public void testGetSOAPMessageInBound() throws Exception {
>          List<Handler> list = new ArrayList<Handler>();
>          list.add(new SOAPHandler<SOAPMessageContext>() {
>              public boolean handleMessage(SOAPMessageContext smc) {
> @@ -368,7 +447,7 @@
>          assertEquals("sendReceiveData", qn.getLocalPart());
>      }
>
> -    public void xtestgetUnderstoodHeadersReturnsNull() {
> +    public void testgetUnderstoodHeadersReturnsNull() {
>          List<Handler> list = new ArrayList<Handler>();
>          list.add(new SOAPHandler<SOAPMessageContext>() {
>              public boolean handleMessage(SOAPMessageContext smc) {
>
> Added:
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/resources/greetMeRpcLitRespWithHeader.xml URL:
> http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/
>test/java/org/apache/cxf/jaxws/handler/soap/resources/greetMeRpcLitRespW
>ithHeader.xml?view=auto&rev=471449
> =======================================================================
>======= ---
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/resources/greetMeRpcLitRespWithHeader.xml (added) +++
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/resources/greetMeRpcLitRespWithHeader.xml Sun Nov  5
> 07:51:22 2006 @@ -0,0 +1,37 @@
> +<?xml version="1.0" encoding="utf-8" ?>
> +<!--
> +  Licensed to the Apache Software Foundation (ASF) under one
> +  or more contributor license agreements. See the NOTICE file
> +  distributed with this work for additional information
> +  regarding copyright ownership. The ASF licenses this file
> +  to you under the Apache License, Version 2.0 (the
> +  "License"); you may not use this file except in compliance
> +  with the License. You may obtain a copy of the License at
> +
> +  http://www.apache.org/licenses/LICENSE-2.0
> +
> +  Unless required by applicable law or agreed to in writing,
> +  software distributed under the License is distributed on an
> +  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +  KIND, either express or implied. See the License for the
> +  specific language governing permissions and limitations
> +  under the License.
> +-->
> +<SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" +		  
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> +		   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> +    <SOAP-ENV:Header>
> +	<ns2:header1 xmlns:ns2="http://apache.org/hello_world_rpclit/types"
> SOAP-ENV:mustUnderstand="true"> +	</ns2:header1>
> +    </SOAP-ENV:Header>
> +    <SOAP-ENV:Body>
> +	<ns1:sendReceiveDataResponse
> xmlns:ns1="http://apache.org/hello_world_rpclit"> +	    <ns5:out
> xmlns:ns5="http://apache.org/hello_world_rpclit/types">
> +		<ns5:elem1>return is element 2</ns5:elem1>
> +		<ns5:elem2>return is element 1</ns5:elem2>
> +		<ns5:elem3>100</ns5:elem3>
> +	    </ns5:out>
> +	</ns1:sendReceiveDataResponse>
> +    </SOAP-ENV:Body>
> +</SOAP-ENV:Envelope>
> +
>
> Propchange:
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/resources/greetMeRpcLitRespWithHeader.xml
> -----------------------------------------------------------------------
>------- svn:eol-style = native
>
> Propchange:
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/resources/greetMeRpcLitRespWithHeader.xml
> -----------------------------------------------------------------------
>------- svn:keywords = Rev Date
>
> Propchange:
> incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxw
>s/handler/soap/resources/greetMeRpcLitRespWithHeader.xml
> -----------------------------------------------------------------------
>------- svn:mime-type = text/xml

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194   F:781-902-8001
daniel.kulp@iona.com

Mime
View raw message