Search in sources :

Example 1 with ReferenceParametersAddingHandler

use of org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler in project cxf by apache.

the class SubscriptionEndNotificationTask method run.

@Override
public void run() {
    try {
        // needed SOAP handlers
        ReferenceParametersAddingHandler handler = new ReferenceParametersAddingHandler(target.getNotificationReferenceParams());
        JaxWsProxyFactoryBean service = new JaxWsProxyFactoryBean();
        service.getOutInterceptors().add(new LoggingOutInterceptor());
        service.setServiceClass(EndToEndpoint.class);
        service.setAddress(target.getEndToURL());
        service.getHandlers().add(handler);
        EndToEndpoint endpoint = (EndToEndpoint) service.create();
        SubscriptionEnd message = new SubscriptionEnd();
        message.setStatus(status.toString());
        if (reason != null) {
            LanguageSpecificStringType reasonElement = new LanguageSpecificStringType();
            reasonElement.setLang("en-US");
            reasonElement.setValue(reason);
            message.getReason().add(reasonElement);
        }
        endpoint.subscriptionEnd(message);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SubscriptionEnd(org.apache.cxf.ws.eventing.SubscriptionEnd) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) EndToEndpoint(org.apache.cxf.ws.eventing.client.EndToEndpoint) ReferenceParametersAddingHandler(org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler) LanguageSpecificStringType(org.apache.cxf.ws.eventing.LanguageSpecificStringType)

Example 2 with ReferenceParametersAddingHandler

use of org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler in project cxf by apache.

the class SimpleEventingIntegrationTest method createSubscriptionManagerClient.

/**
 * Convenience method to create a client for the testing Subscription Manager
 * which is located at local://SimpleSubscriptionManager.
 * You have to specify the reference parameters you obtained from the Event Source
 * when your subscription was created.
 *
 * @return a JAX-WS client set up for managing the subscription you had created using the Event Source
 */
public SubscriptionManagerEndpoint createSubscriptionManagerClient(ReferenceParametersType refs) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setBus(bus);
    factory.setServiceClass(SubscriptionManagerEndpoint.class);
    factory.setAddress(URL_SUBSCRIPTION_MANAGER);
    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    ReferenceParametersAddingHandler handler = new ReferenceParametersAddingHandler(refs);
    factory.getHandlers().add(handler);
    return (SubscriptionManagerEndpoint) factory.create();
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) SubscriptionManagerEndpoint(org.apache.cxf.ws.eventing.manager.SubscriptionManagerEndpoint) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) ReferenceParametersAddingHandler(org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler)

Example 3 with ReferenceParametersAddingHandler

use of org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler in project cxf by apache.

the class EventSinkInterfaceNotificationTask method getProxy.

protected Object getProxy(Class<?> sinkInterface, Class<?>... extraClasses) {
    // needed SOAP handlers
    ReferenceParametersAddingHandler handler = new ReferenceParametersAddingHandler(target.getNotificationReferenceParams());
    JaxWsProxyFactoryBean service = new JaxWsProxyFactoryBean();
    service.getOutInterceptors().add(new LoggingOutInterceptor());
    service.setServiceClass(sinkInterface);
    service.setAddress(target.getTargetURL());
    service.getHandlers().add(handler);
    // do we need to apply a filter?
    if (target.getFilter() != null && target.getFilter().getContent().size() > 0) {
        service.getOutInterceptors().add(new FilteringInterceptor(target.getFilter()));
    }
    if (extraClasses != null && extraClasses.length > 0) {
        Map<String, Object> props = new HashMap<>();
        props.put("jaxb.additionalContextClasses", extraClasses);
        service.getClientFactoryBean().getServiceFactory().setProperties(props);
    }
    return service.create();
}
Also used : HashMap(java.util.HashMap) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) ReferenceParametersAddingHandler(org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler)

Aggregations

LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)3 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)3 ReferenceParametersAddingHandler (org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler)3 HashMap (java.util.HashMap)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1 LanguageSpecificStringType (org.apache.cxf.ws.eventing.LanguageSpecificStringType)1 SubscriptionEnd (org.apache.cxf.ws.eventing.SubscriptionEnd)1 EndToEndpoint (org.apache.cxf.ws.eventing.client.EndToEndpoint)1 SubscriptionManagerEndpoint (org.apache.cxf.ws.eventing.manager.SubscriptionManagerEndpoint)1