Hi everyone, just working unit testing a service and interceptor. I would
like to launch the service using the local transport, create a proxy, send
some requests/back worth while monitoring the interceptor.

I'm getting this stack trace on execution and i'm completely stuck. I
disabled my custom interceptor until I figure out what's going on:
org.apache.cxf.interceptor.Fault: Could not write to XMLStreamWriter.
        at
org.apache.cxf.interceptor.WrappedOutInterceptor.handleMessage(WrappedOutInterceptor.java:74)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:74)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
        at
org.apache.cxf.transport.local.LocalConduit$1$1.run(LocalConduit.java:132)
        at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: Non-default namespace can
not map to empty URI (as per Namespace 1.0 # 2) in XML 1.0 documents
        at
com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1467)
        at
com.ctc.wstx.sw.BaseNsStreamWriter.setPrefix(BaseNsStreamWriter.java:209)
        at
org.apache.cxf.interceptor.WrappedOutInterceptor.handleMessage(WrappedOutInterceptor.java:70)
        ... 6 more

Here is the code I'm using to generate server/proxy:
        @BeforeClass
        public static void setupForTesting(){
                ServerFactoryBean svrFactory = new ServerFactoryBean();
                svrFactory.setServiceClass(AService.class);
                svrFactory.setAddress("cxf:vm://local/AService/1.0"); 
                svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
                svrFactory.setServiceBean(new AServiceImpl());
                svrFactory.setInInterceptors(getInInterceptors());
                svrFactory.setInInterceptors(getOutInterceptors());
                svrFactory.setServiceName(new QName("AService/1.0"));
                svrFactory.create();
                
                ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
                factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
                factory.setServiceClass(AService.class); 
                factory.setAddress("cxf:vm://local/AService/1.0"); 
                aServiceProxy  = (AService) factory.create();
        }

        @SuppressWarnings("unchecked")
        private static List<Interceptor> getOutInterceptors() {
                List<Interceptor> list = new ArrayList<Interceptor>();
                //list.add((Interceptor)
context.getBean("ut.simple.cxf.SimpleUsageTrackingCXFInterceptor"));
                return list;
        }

        @SuppressWarnings("unchecked")
        private static List<Interceptor> getInInterceptors() {
                List<Interceptor> list = new ArrayList<Interceptor>();
                list.add(new 
org.apache.cxf.binding.soap.saaj.SAAJInInterceptor());
                list.add(new
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor(getSecurityProperties()));
                //list.add((Interceptor)
context.getBean("ut.simple.cxf.SimpleUsageTrackingCXFInterceptor"));
                return list;
        }


Thanks guys, i'm going to keep poking away here.



-- 
View this message in context: 
http://www.nabble.com/Exception-using-local-transport%3A-%22Non-default-namespace-can-not-map-to-empty-URI%22-tp24943449p24943449.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to