Search in sources :

Example 31 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class JmsConfigurator method configureEndpoint.

public Endpoint configureEndpoint(Endpoint endpoint) {
    if (jmsConfiguration == null || !(endpoint instanceof EndpointImpl) || (serviceName == null && configuration == null)) {
        return null;
    }
    if (!jmsConfigured) {
        setupJmsConfiguration();
    }
    final EndpointImpl ei = (EndpointImpl) endpoint;
    final JMSConfigFeature feature = new JMSConfigFeature();
    feature.setJmsConfig(jmsConfiguration);
    List<Feature> features = ei.getFeatures();
    if (features == null) {
        features = new ArrayList<Feature>();
    }
    features.add(feature);
    ei.setFeatures(features);
    return endpoint;
}
Also used : JMSConfigFeature(org.apache.cxf.transport.jms.JMSConfigFeature) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) Feature(org.apache.cxf.feature.Feature) JMSConfigFeature(org.apache.cxf.transport.jms.JMSConfigFeature)

Example 32 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class JmsUriConfigurator method create.

public static JmsUriConfigurator create(Endpoint endpoint) {
    if (!(endpoint instanceof EndpointImpl)) {
        return null;
    }
    final EndpointImpl ep = (EndpointImpl) endpoint;
    final QName serviceName = ep.getServiceName();
    if (serviceName == null) {
        return null;
    }
    final QName endpointName = ep.getEndpointName();
    final String portName = endpointName == null ? null : endpointName.getLocalPart();
    JmsUriConfigurator result = new JmsUriConfigurator();
    result.setConfigurationPrefix(portName);
    result.setServiceName(serviceName);
    return result;
}
Also used : QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl)

Example 33 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class CallContext method createCallbackEndpoint.

public static Endpoint createCallbackEndpoint(final Object implementor, final CallbackInfo cbInfo, final String policyAlias) {
    final Bus bus = BusFactory.getThreadDefaultBus();
    final JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
    final List<Feature> features = new ArrayList<Feature>();
    features.add(new RequestCallbackFeature());
    if (logging) {
        features.add(new LoggingFeature());
    }
    if (serviceActivityMonitoring) {
        features.add(getEventFeature());
    }
    serverFactory.setFeatures(features);
    final QName cbInterfaceName;
    final String wsdlLocation;
    if (cbInfo == null) {
        cbInterfaceName = null;
        wsdlLocation = null;
    } else {
        cbInterfaceName = cbInfo.getCallbackPortTypeName();
        wsdlLocation = cbInfo.getEffectiveCallbackReceiverWsdlLocation(policyAlias);
    }
    final boolean useWsdlLocation = wsdlLocation != null && cbInfo.getCallbackServiceName() != null && cbInfo.getCallbackPortName() != null;
    if (cbInterfaceName != null) {
        final QName cbServiceName = cbInfo.getCallbackServiceName() == null ? new QName(cbInterfaceName.getNamespaceURI(), cbInterfaceName.getLocalPart() + "Service") : cbInfo.getCallbackServiceName();
        final QName cbEndpointName = cbInfo.getCallbackServiceName() == null ? new QName(cbInterfaceName.getNamespaceURI(), cbInterfaceName.getLocalPart() + "ServicePort") : new QName(cbServiceName.getNamespaceURI(), cbInfo.getCallbackPortName() == null ? cbServiceName.getLocalPart() + "Port" : cbInfo.getCallbackPortName());
        serverFactory.setServiceName(cbServiceName);
        serverFactory.setEndpointName(cbEndpointName);
        final List<AbstractServiceConfiguration> svcConfigs = serverFactory.getServiceFactory().getServiceConfigurations();
        for (ListIterator<AbstractServiceConfiguration> it = svcConfigs.listIterator(); it.hasNext(); ) {
            final AbstractServiceConfiguration cfg = it.next();
            if (cfg instanceof DefaultServiceConfiguration) {
                final AbstractServiceConfiguration ncfg = new CallbackDefaultServiceConfiguration(cbInfo);
                it.set(ncfg);
            }
        }
        if (useWsdlLocation) {
            serverFactory.setWsdlLocation(wsdlLocation);
        }
    }
    final EndpointImpl endpoint = new EndpointImpl(bus, implementor, serverFactory);
    endpoint.setFeatures(features);
    endpoint.getProperties().put(NULL_MEANS_ONEWAY, Boolean.TRUE);
    if (cbInterfaceName != null) {
        endpoint.setEndpointName(serverFactory.getEndpointName());
        endpoint.setServiceName(serverFactory.getServiceName());
        if (useWsdlLocation) {
            endpoint.setWsdlLocation(wsdlLocation);
        }
    }
    return endpoint;
}
Also used : Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) ArrayList(java.util.ArrayList) Feature(org.apache.cxf.feature.Feature) LoggingFeature(org.apache.cxf.feature.LoggingFeature) DefaultServiceConfiguration(org.apache.cxf.wsdl.service.factory.DefaultServiceConfiguration) CallbackDefaultServiceConfiguration(org.talend.esb.mep.requestcallback.impl.wsdl.CallbackDefaultServiceConfiguration) AbstractServiceConfiguration(org.apache.cxf.wsdl.service.factory.AbstractServiceConfiguration) LoggingFeature(org.apache.cxf.feature.LoggingFeature) CallbackDefaultServiceConfiguration(org.talend.esb.mep.requestcallback.impl.wsdl.CallbackDefaultServiceConfiguration) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 34 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class RequestCallbackOutInterceptor method doHandleSoapMessage.

private void doHandleSoapMessage(SoapMessage message) throws Fault {
    final Object callbackEndpoint = message.getContextualProperty(RequestCallbackFeature.CALLBACK_ENDPOINT_PROPERTY_NAME);
    if (callbackEndpoint != null) {
        final String callbackEndpointAddress;
        if (callbackEndpoint instanceof String) {
            callbackEndpointAddress = (String) callbackEndpoint;
        } else if (callbackEndpoint instanceof EndpointImpl) {
            callbackEndpointAddress = ((EndpointImpl) callbackEndpoint).getAddress();
        } else {
            throw new IllegalArgumentException("Unsupported type of endpoint. ");
        }
        doHandleRequestSoapMessage(message, callbackEndpointAddress);
        return;
    }
    final CallContext ctx = (CallContext) message.getContextualProperty(RequestCallbackFeature.CALLCONTEXT_PROPERTY_NAME);
    if (ctx != null) {
        doHandleCallbackSoapMessage(message, ctx);
        return;
    }
}
Also used : EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) CallContext(org.talend.esb.mep.requestcallback.feature.CallContext)

Example 35 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project springBoot-learn-demo by nbfujx.

the class CxfConfig method endpoint.

@Bean
public Endpoint endpoint() {
    EndpointImpl endpoint = new EndpointImpl(bus, examplecontroller);
    // 接口发布在 /NetbarServices 目录下
    endpoint.publish("/ExampleService");
    return endpoint;
}
Also used : EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) Bean(org.springframework.context.annotation.Bean)

Aggregations

EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)61 QName (javax.xml.namespace.QName)14 Test (org.junit.Test)9 Bus (org.apache.cxf.Bus)8 BeforeClass (org.junit.BeforeClass)7 Bean (org.springframework.context.annotation.Bean)7 Endpoint (javax.xml.ws.Endpoint)5 URL (java.net.URL)4 HashMap (java.util.HashMap)4 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)4 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)4 Feature (org.apache.cxf.feature.Feature)4 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)4 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)3 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 JAXBException (javax.xml.bind.JAXBException)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 WebServiceException (javax.xml.ws.WebServiceException)2