Search in sources :

Example 1 with HandlerConfiguration

use of com.sun.xml.ws.client.HandlerConfiguration in project metro-jax-ws by eclipse-ee4j.

the class ClientMUTube method processResponse.

/**
 * Do MU Header Processing on incoming message (response)
 *
 * @return
 *         if all the headers in the packet are understood, returns an action to
 *         call the previous pipes with response packet
 * @throws SOAPFaultException
 *         if all the headers in the packet are not understood, throws SOAPFaultException
 */
@Override
@NotNull
public NextAction processResponse(Packet response) {
    if (response.getMessage() == null) {
        return super.processResponse(response);
    }
    HandlerConfiguration handlerConfig = response.handlerConfig;
    if (handlerConfig == null) {
        // Use from binding instead of defaults in case response packet does not have it,
        // may have been changed from the time of invocation, it ok as its only fallback case.
        handlerConfig = binding.getHandlerConfig();
    }
    Set<QName> misUnderstoodHeaders = getMisUnderstoodHeaders(response.getMessage().getHeaders(), handlerConfig.getRoles(), binding.getKnownHeaders());
    if ((misUnderstoodHeaders == null) || misUnderstoodHeaders.isEmpty()) {
        return super.processResponse(response);
    }
    throw createMUSOAPFaultException(misUnderstoodHeaders);
}
Also used : HandlerConfiguration(com.sun.xml.ws.client.HandlerConfiguration) QName(javax.xml.namespace.QName) NotNull(com.sun.istack.NotNull)

Example 2 with HandlerConfiguration

use of com.sun.xml.ws.client.HandlerConfiguration in project metro-jax-ws by eclipse-ee4j.

the class ServerMessageHandlerTube method setUpHandlersOnce.

private void setUpHandlersOnce() {
    handlers = new ArrayList<>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<MessageHandler> msgHandlersSnapShot = handlerConfig.getMessageHandlers();
    if (!msgHandlersSnapShot.isEmpty()) {
        handlers.addAll(msgHandlersSnapShot);
        roles = new HashSet<>();
        roles.addAll(handlerConfig.getRoles());
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) HandlerConfiguration(com.sun.xml.ws.client.HandlerConfiguration) MessageHandler(com.sun.xml.ws.api.handler.MessageHandler)

Example 3 with HandlerConfiguration

use of com.sun.xml.ws.client.HandlerConfiguration in project metro-jax-ws by eclipse-ee4j.

the class ServerSOAPHandlerTube method setUpHandlersOnce.

private void setUpHandlersOnce() {
    handlers = new ArrayList<>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot = handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<>();
        roles.addAll(handlerConfig.getRoles());
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) HandlerConfiguration(com.sun.xml.ws.client.HandlerConfiguration) SOAPHandler(jakarta.xml.ws.handler.soap.SOAPHandler)

Example 4 with HandlerConfiguration

use of com.sun.xml.ws.client.HandlerConfiguration in project metro-jax-ws by eclipse-ee4j.

the class SOAPBindingImpl method setRoles.

/**
 * Adds the next and other roles in case this has
 * been called by a user without them.
 * Creates a new HandlerConfiguration object and sets it on the BindingImpl.
 */
public void setRoles(Set<String> roles) {
    if (roles == null) {
        roles = new HashSet<>();
    }
    if (roles.contains(ROLE_NONE)) {
        throw new WebServiceException(ClientMessages.INVALID_SOAP_ROLE_NONE());
    }
    addRequiredRoles(roles);
    setHandlerConfig(new HandlerConfiguration(roles, getHandlerConfig()));
}
Also used : HandlerConfiguration(com.sun.xml.ws.client.HandlerConfiguration) WebServiceException(jakarta.xml.ws.WebServiceException)

Example 5 with HandlerConfiguration

use of com.sun.xml.ws.client.HandlerConfiguration in project metro-jax-ws by eclipse-ee4j.

the class ClientMessageHandlerTube method setUpProcessor.

void setUpProcessor() {
    if (handlers == null) {
        // Take a snapshot, User may change chain after invocation, Same chain
        // should be used for the entire MEP
        handlers = new ArrayList<>();
        HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
        List<MessageHandler> msgHandlersSnapShot = handlerConfig.getMessageHandlers();
        if (!msgHandlersSnapShot.isEmpty()) {
            handlers.addAll(msgHandlersSnapShot);
            roles = new HashSet<>();
            roles.addAll(handlerConfig.getRoles());
            processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
        }
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) HandlerConfiguration(com.sun.xml.ws.client.HandlerConfiguration) MessageHandler(com.sun.xml.ws.api.handler.MessageHandler)

Aggregations

HandlerConfiguration (com.sun.xml.ws.client.HandlerConfiguration)7 BindingImpl (com.sun.xml.ws.binding.BindingImpl)5 MessageHandler (com.sun.xml.ws.api.handler.MessageHandler)2 SOAPHandler (jakarta.xml.ws.handler.soap.SOAPHandler)2 NotNull (com.sun.istack.NotNull)1 WebServiceException (jakarta.xml.ws.WebServiceException)1 QName (javax.xml.namespace.QName)1