Search in sources :

Example 21 with DispatchImpl

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

the class JmsConfigurator method configureDispatch.

public <T> Dispatch<T> configureDispatch(Dispatch<T> dispatch, String addressing) {
    if (configuration == null) {
        if (serviceName == null) {
            return null;
        }
        configuration = CallContext.resolveConfiguration(serviceName);
    }
    String overrideAddress = getProperty("requestURI2010");
    if (overrideAddress != null && (overrideAddress.equals(addressing) || OVERRIDE_BY_URI_CONFIG.equals(addressing))) {
        return dispatch;
    }
    if (jmsConfiguration == null || !(dispatch instanceof DispatchImpl<?>) || (serviceName == null && configuration == null)) {
        return null;
    }
    if (!jmsConfigured) {
        setupJmsConfiguration();
    }
    final DispatchImpl<?> di = (DispatchImpl<?>) dispatch;
    final Client cl = di.getClient();
    final JMSConfigFeature feature = new JMSConfigFeature();
    feature.setJmsConfig(jmsConfiguration);
    feature.initialize(cl, cl.getBus());
    return dispatch;
}
Also used : JMSConfigFeature(org.apache.cxf.transport.jms.JMSConfigFeature) DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) Client(org.apache.cxf.endpoint.Client)

Example 22 with DispatchImpl

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

the class JmsConfigurator method configureDispatch.

public <T> Dispatch<T> configureDispatch(Dispatch<T> dispatch) {
    if (jmsConfiguration == null || !(dispatch instanceof DispatchImpl<?>) || (serviceName == null && configuration == null)) {
        return null;
    }
    if (!jmsConfigured) {
        setupJmsConfiguration();
    }
    final DispatchImpl<?> di = (DispatchImpl<?>) dispatch;
    final Client cl = di.getClient();
    final JMSConfigFeature feature = new JMSConfigFeature();
    feature.setJmsConfig(jmsConfiguration);
    feature.initialize(cl, cl.getBus());
    return dispatch;
}
Also used : JMSConfigFeature(org.apache.cxf.transport.jms.JMSConfigFeature) DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) Client(org.apache.cxf.endpoint.Client)

Example 23 with DispatchImpl

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

the class JmsUriConfigurator method create.

public static JmsUriConfigurator create(Dispatch<?> dispatch) {
    if (!(dispatch instanceof DispatchImpl<?>)) {
        return null;
    }
    DispatchImpl<?> dsp = (DispatchImpl<?>) dispatch;
    Client cl = dsp.getClient();
    final QName serviceName;
    try {
        serviceName = cl.getEndpoint().getService().getName();
    } catch (Exception e) {
        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.log(Level.FINER, "Exception caught: ", e);
        }
        return null;
    }
    if (serviceName == null) {
        return null;
    }
    EndpointInfo endpointInfo;
    QName endpointName;
    String endpointAddress;
    try {
        endpointInfo = cl.getEndpoint().getEndpointInfo();
        endpointName = endpointInfo.getName();
        endpointAddress = endpointInfo.getAddress();
    } catch (Exception e) {
        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.log(Level.FINER, "Exception caught: ", e);
        }
        endpointInfo = null;
        endpointName = null;
        endpointAddress = null;
    }
    final String portName = endpointName == null ? null : endpointName.getLocalPart();
    JmsUriConfigurator result = new JmsUriConfigurator();
    result.setConfigurationPrefix(portName);
    result.setServiceName(serviceName);
    if (endpointAddress != null && endpointAddress.startsWith("jms:")) {
        result.setPresetJmsAddress(endpointAddress);
    }
    return result;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) QName(javax.xml.namespace.QName) Client(org.apache.cxf.endpoint.Client)

Example 24 with DispatchImpl

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

the class JmsUriConfigurator method configureDispatch.

public <T> Dispatch<T> configureDispatch(Dispatch<T> dispatch) {
    if (!(dispatch instanceof DispatchImpl<?>) || (serviceName == null && configuration == null)) {
        return null;
    }
    final DispatchImpl<?> di = (DispatchImpl<?>) dispatch;
    final Client cl = di.getClient();
    try {
        String jmsAddr = getJmsAddress();
        cl.getRequestContext().put(Message.ENDPOINT_ADDRESS, jmsAddr);
        cl.getEndpoint().getEndpointInfo().setAddress(jmsAddr);
    } catch (Exception e) {
        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.log(Level.FINER, "Exception caught: ", e);
        }
        return null;
    }
    return dispatch;
}
Also used : DispatchImpl(org.apache.cxf.jaxws.DispatchImpl) Client(org.apache.cxf.endpoint.Client)

Aggregations

DispatchImpl (org.apache.cxf.jaxws.DispatchImpl)24 Client (org.apache.cxf.endpoint.Client)18 QName (javax.xml.namespace.QName)12 Service (javax.xml.ws.Service)12 URL (java.net.URL)10 Bus (org.apache.cxf.Bus)9 DOMSource (javax.xml.transform.dom.DOMSource)8 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)7 Document (org.w3c.dom.Document)7 Test (org.junit.Test)6 Source (javax.xml.transform.Source)5 StreamSource (javax.xml.transform.stream.StreamSource)5 AddressingFeature (javax.xml.ws.soap.AddressingFeature)4 STSClient (org.apache.cxf.ws.security.trust.STSClient)4 HashMap (java.util.HashMap)3 AbstractJaxWsTest (org.apache.cxf.jaxws.AbstractJaxWsTest)3 MessageReplayObserver (org.apache.cxf.jaxws.MessageReplayObserver)3 ServiceImpl (org.apache.cxf.jaxws.ServiceImpl)3 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)3 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)3