You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Joel Turkel <jo...@alumni.brown.edu> on 2008/02/04 17:59:55 UTC
Fast Infoset
Hi,
Has anyone had any luck plugging in the java.net Fast Infoset reference implementation into CXF? I tried doing something like the following:
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import com.sun.xml.fastinfoset.stax.factory.StAXInputFactory;
import com.sun.xml.fastinfoset.stax.factory.StAXOutputFactory;
...
// Server setup
JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
serverFactory.setAddress("http://localhost:12345/MyService");
serverFactory.setServiceClass(MyService.class);
serverFactory.setServiceBean(new MyServiceImpl());
Map<String,Object> properties = new HashMap<String,Object>();
properties.put(XMLInputFactory.class.getName(), new MyXmlInputFactory());
properties.put(XMLOutputFactory.class.getName(), new MyXmlOutputFactory());
serverFactory.setProperties(properties);
serverFactory.create();
// Client setup
JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
clientFactory.setAddress("http://localhost:12345/MyService");
clientFactory.setServiceClass(MyService.class);
Map<String,Object> properties = new HashMap<String,Object>();
properties.put(XMLInputFactory.class.getName(), new StAXInputFactory());
properties.put(XMLOutputFactory.class.getName(), new StAXOutputFactory());
clientFactory.setProperties(properties);
MyService service = (MyService)clientFactory.create();
Unfortunately invoking any methods on client proxy results in the following exception because the Fast Infoset vocabulary has not been setup:
Caused by: java.lang.NullPointerException
at com.sun.xml.fastinfoset.Encoder.encodeNamespaceAttribute(Encoder.java:558)
at com.sun.xml.fastinfoset.stax.StAXDocumentSerializer.encodeTerminationAndCurrentElement(StAXDocumentSerializer.java:581)
at com.sun.xml.fastinfoset.stax.StAXDocumentSerializer.writeStartElement(StAXDocumentSerializer.java:215)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:130)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:76)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:57)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
... 2 more
Setting up an empty vocabulary on the StAXDocumentSerializer seems to cause an infinite loop in org.apache.cxf.interceptor.WrappedOutInterceptor.handleMessage(). Anyone have any suggestions before I dig much deeper?
Thanks,
Joel