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 16:12:05 GMT

Jervis,

Thanks for fixing the tests.

There are still some eclipse warnings:
Line 158 - message is never read
Line 399 - message is never read
Line 518 - doc is never read
Line 559 - the prepareOutputStreamFromSOAPMessage method is never called

Could you look into those as well.

Thanks!
Dan


On Monday November 06 2006 2:43 am, Liu, Jervis wrote:
> This problem is specific to Jdk 1.5.0_08 and 09, it should be ok for
> those who is running under jdk 1.5.0_05. Still looking into it...
>
> > -----Original Message-----
> > From: Liu, Jervis [mailto:jliu@iona.com]
> > Sent: Monday, November 06, 2006 12:15 PM
> > To: cxf-dev@incubator.apache.org
> > 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/
> >
> >
> > Looking into this. It passed on my W2k box.
> >
> > Thanks,
> > Jervis
> >
> > > -----Original Message-----
> > > From: Daniel Kulp [mailto:daniel.kulp@iona.com]
> > > Sent: Monday, November 06, 2006 11:35 AM
> > > To: cxf-dev@incubator.apache.org
> > > 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/
> > >
> > >
> > >
> > >
> > > 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.handl
> > > eMessage(SOAPHandlerInterceptor.java:177)
> > >         at
> > > org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptorTest.t
> > > estChangeSOAPHeaderInBound(SOAPHandlerInterceptorTest.java:288)
> > >         at
> >
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > >         at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> > > orImpl.java:39)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > > odAccessorImpl.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(NativeMethodAccess
> > > orImpl.java:39)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > > odAccessorImpl.java:25)
> > >         at java.lang.reflect.Method.invoke(Method.java:585)
> > >         at
> > > org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JU
> > > nitBattery.java:242)
> > >         at
> > > org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBa
> > > ttery.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(NativeMethodAccess
> > > orImpl.java:39)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > > odAccessorImpl.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(BasicStreamRe
> > > ader.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.handl
> > > eMessage(SOAPHandlerInterceptor.java:156)
> > >         ... 28 more
> > >
> > > [surefire]
> > > testGetSOAPMessageInBound(org.apache.cxf.jaxws.handler.soap.SO
> > > APHandlerInterceptorTest)
> > > Time elapsed: 0.003 sec  <<< ERROR!
> > > org.apache.cxf.binding.soap.SoapFault: SOAPHandlerInterceptor
> > > exception
> > >         at
> > > org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handl
> > > eMessage(SOAPHandlerInterceptor.java:173)
> > >         at
> > > org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptorTest.t
> > > estGetSOAPMessageInBound(SOAPHandlerInterceptorTest.java:434)
> > >         at
> >
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > >         at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> > > orImpl.java:39)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > > odAccessorImpl.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(NativeMethodAccess
> > > orImpl.java:39)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > > odAccessorImpl.java:25)
> > >         at java.lang.reflect.Method.invoke(Method.java:585)
> > >         at
> > > org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JU
> > > nitBattery.java:242)
> > >         at
> > > org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBa
> > > ttery.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(NativeMethodAccess
> > > orImpl.java:39)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> > > odAccessorImpl.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.createE
> > > nvelopeFromSource(SOAPPart1_1Impl.java:71)
> > >         at
> > > com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPP
> > > artImpl.java:125)
> > >         at
> > > com.sun.xml.messaging.saaj.soap.MessageImpl.getSOAPBody(Messag
> > > eImpl.java:1237)
> > >         at
> > > org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handl
> > > eMessage(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.t
> > > ransform(TransformerImpl.java:651)
> > >         at
> > > com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.t
> > > ransform(TransformerImpl.java:281)
> > >         at
> > > com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTr
> > > ansformer.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.checkD
> > > OMNSErr(CoreDocumentImpl.java:2421)
> > >         at
> > > com.sun.org.apache.xerces.internal.dom.AttrNSImpl.setName(Attr
> > > NSImpl.java:150)
> > >         at
> > > com.sun.org.apache.xerces.internal.dom.AttrNSImpl.<init>(AttrN
> > > SImpl.java:111)
> > >         at
> > > com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.create
> > > AttributeNS(CoreDocumentImpl.java:2012)
> > >         at
> > > com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.createAttribu
> > > teNS(SOAPDocumentImpl.java:161)
> > >         at
> > > com.sun.org.apache.xerces.internal.dom.ElementImpl.setAttribut
> > > eNS(ElementImpl.java:684)
> > >         at
> > > com.sun.xml.messaging.saaj.soap.impl.ElementImpl.setAttributeN
> > > S(ElementImpl.java:1213)
> > >         at
> > > com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.startElem
> > > ent(SAX2DOM.java:134)
> > >         at
> > > com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.clo
> > > seStartTag(ToXMLSAXHandler.java:205)
> > >         at
> > > com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushP
> > > ending(ToSAXHandler.java:291)
> > >         at
> > > com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.sta
> > > rtPrefixMapping(ToXMLSAXHandler.java:349)
> > >         at
> > > com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.sta
> > > rtPrefixMapping(ToXMLSAXHandler.java:319)
> > >         at
> > > org.xml.sax.helpers.XMLFilterImpl.startPrefixMapping(XMLFilter
> > > Impl.java:490)
> > >         at
> > > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.s
> > > tartNamespaceMapping(AbstractSAXParser.java:2063)
> > >         at
> > > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.s
> > > tartElement(AbstractSAXParser.java:499)
> > >         at
> > > com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerIm
> > > pl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> > >         at
> > > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentSca
> > > nnerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmen
> > > tScannerImpl.java:1693)
> > >         at
> > > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentSca
> > > nnerImpl.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(XML
> > > Parser.java:148)
> > >         at
> > > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.p
> > > arse(AbstractSAXParser.java:1242)
> > >         at
> > > org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
> > >         at
> > > com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.t
> > > ransformIdentity(TransformerImpl.java:588)
> > >         at
> > > com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.t
> > > ransform(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/j
> > > axws/src/
> > >
> > > >main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterc
> > >
> > > eptor.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/j
> > > axws/src/
> > >
> > > >test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterc
> > >
> > > eptorTest.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(invo
> >
> > ker).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(invo
> >
> > ker).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(invo
> >
> > ker).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(invo
> >
> > ker).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(invo
> >
> > ker).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/j
> > > axws/src/
> > >
> > > >test/java/org/apache/cxf/jaxws/handler/soap/resources/greetMe
> > >
> > > RpcLitRespW
> > >
> > > >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

-- 
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