Search in sources :

Example 1 with CallContext

use of org.talend.esb.mep.requestcallback.feature.CallContext in project tesb-rt-se by Talend.

the class ServiceProviderHandler method invoke.

@Override
public StreamSource invoke(StreamSource request) {
    try {
        System.out.println("Service is invoked!!!");
        CallContext callContext = CallContext.getCallContext(wsContext);
        assertEquals(callContext.getOperationName().getLocalPart(), expectedOperation);
        businessHandler.handleMessage(request, callContext);
    } catch (Exception e) {
        addError(e);
    } catch (AssertionError e) {
        addError(e);
    }
    return null;
}
Also used : CallContext(org.talend.esb.mep.requestcallback.feature.CallContext)

Example 2 with CallContext

use of org.talend.esb.mep.requestcallback.feature.CallContext in project tesb-rt-se by Talend.

the class ClientProviderHandler method invoke.

@Override
public StreamSource invoke(StreamSource request) {
    try {
        CallContext context = CallContext.getCallContext(wsContext);
        assertNotNull("CallContext missing", context);
        QName opName = context.getOperationName();
        assertNotNull("Response action missing", opName);
        IncomingMessageHandler businessHandler = callbackMap.get(opName.getLocalPart());
        if (businessHandler == null) {
            throw new RuntimeException("Unknown callback operation: " + context.getOperationName().getLocalPart());
        }
        businessHandler.handleMessage(request, context);
    } catch (Exception e) {
        addError(e);
    } catch (AssertionError e) {
        addError(e);
    }
    return null;
}
Also used : QName(javax.xml.namespace.QName) CallContext(org.talend.esb.mep.requestcallback.feature.CallContext)

Example 3 with CallContext

use of org.talend.esb.mep.requestcallback.feature.CallContext in project tesb-rt-se by Talend.

the class CallContextFactoryImpl method createObjectKey.

@Override
public String createObjectKey(E ctxObj) {
    if (ctxObj instanceof CallContext) {
        CallContext ctx = (CallContext) ctxObj;
        String key = ctx.getCallId();
        return prettifyCallContextKey(key);
    }
    return null;
}
Also used : CallContext(org.talend.esb.mep.requestcallback.feature.CallContext)

Example 4 with CallContext

use of org.talend.esb.mep.requestcallback.feature.CallContext in project tesb-rt-se by Talend.

the class RequestCallbackInInterceptor method setupCallContext.

private CallContext setupCallContext(SoapMessage message, Header callHeader, Header callbackHeader) throws Fault {
    final AddressingProperties maps = getAddressingProperties(message);
    if (maps == null) {
        throw new IllegalStateException("Request-Callback enabled but no WS-Addressing headers set. ");
    }
    CallContext ctx = new CallContext();
    message.put(RequestCallbackFeature.CALLCONTEXT_PROPERTY_NAME, ctx);
    final QName operationName = QName.valueOf(maps.getAction().getValue());
    if (!isGenericOperation(operationName)) {
        ctx.setOperationName(operationName);
    }
    ctx.setCallId(valueOf(callHeader));
    if (callbackHeader != null) {
        ctx.setCallbackId(valueOf(callbackHeader));
    }
    ctx.setRequestId(maps.getMessageID().getValue());
    ctx.setReplyToAddress(maps.getReplyTo().getAddress().getValue());
    ctx.setCorrelationId(getCorrelationId(message));
    // in callback message
    if (callbackHeader == null) {
        setupFlowId(message);
    }
    fillCallContext(ctx, message);
    return ctx;
}
Also used : QName(javax.xml.namespace.QName) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) CallContext(org.talend.esb.mep.requestcallback.feature.CallContext)

Example 5 with CallContext

use of org.talend.esb.mep.requestcallback.feature.CallContext in project tesb-rt-se by Talend.

the class RequestCallbackInInterceptor method doHandleRequestSoapMessage.

private void doHandleRequestSoapMessage(SoapMessage message, Header callHeader) throws Fault {
    CallContext ctx = setupCallContext(message, callHeader, null);
    // In case of using requestor certificate for response encryption, store certificate into callContext
    storeRequestorCertificate(message, ctx);
}
Also used : CallContext(org.talend.esb.mep.requestcallback.feature.CallContext)

Aggregations

CallContext (org.talend.esb.mep.requestcallback.feature.CallContext)9 QName (javax.xml.namespace.QName)2 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)1 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)1 CallContextStore (org.talend.esb.mep.requestcallback.impl.callcontext.CallContextStore)1 LibraryConsumer (org.talend.services.demos.library._1_0.LibraryConsumer)1 SeekBookError (org.talend.services.demos.library._1_0.SeekBookError)1 BookType (org.talend.types.demos.library.common._1.BookType)1 ListOfBooks (org.talend.types.demos.library.common._1.ListOfBooks)1 PersonType (org.talend.types.demos.library.common._1.PersonType)1