Search in sources :

Example 1 with WebServiceContextImpl

use of org.apache.cxf.jaxws.context.WebServiceContextImpl in project cxf by apache.

the class ProviderImpl method createEndpoint.

// new in 2.2
public Endpoint createEndpoint(String bindingId, Class<?> implementorClass, Invoker invoker, WebServiceFeature... features) {
    if (EndpointUtils.isValidImplementor(implementorClass)) {
        Bus bus = BusFactory.getThreadDefaultBus();
        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        if (features != null) {
            factory.getJaxWsServiceFactory().setWsFeatures(Arrays.asList(features));
        }
        if (invoker != null) {
            factory.setInvoker(new JAXWSMethodInvoker(invoker));
            try {
                invoker.inject(new WebServiceContextImpl());
            } catch (Exception e) {
                throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG", LOG).toString(), e);
            }
        }
        EndpointImpl ep = new EndpointImpl(bus, null, factory);
        ep.setImplementorClass(implementorClass);
        return ep;
    }
    throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
}
Also used : Bus(org.apache.cxf.Bus) WebServiceException(javax.xml.ws.WebServiceException) Message(org.apache.cxf.common.i18n.Message) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) JAXWSMethodInvoker(org.apache.cxf.jaxws.JAXWSMethodInvoker) WebServiceContextImpl(org.apache.cxf.jaxws.context.WebServiceContextImpl) XMLStreamException(javax.xml.stream.XMLStreamException) PrivilegedActionException(java.security.PrivilegedActionException) JAXBException(javax.xml.bind.JAXBException) WebServiceException(javax.xml.ws.WebServiceException)

Aggregations

PrivilegedActionException (java.security.PrivilegedActionException)1 JAXBException (javax.xml.bind.JAXBException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 WebServiceException (javax.xml.ws.WebServiceException)1 Bus (org.apache.cxf.Bus)1 Message (org.apache.cxf.common.i18n.Message)1 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)1 JAXWSMethodInvoker (org.apache.cxf.jaxws.JAXWSMethodInvoker)1 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)1 WebServiceContextImpl (org.apache.cxf.jaxws.context.WebServiceContextImpl)1