javax.xml.ws.handler.soap.SOAPHandler Java Examples

The following examples show how to use javax.xml.ws.handler.soap.SOAPHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerSOAPHandlerTube.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #2
Source File: ServerSOAPHandlerTube.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #3
Source File: ClientSOAPHandlerTube.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #4
Source File: ServerSOAPHandlerTube.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #5
Source File: ClientSOAPHandlerTube.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #6
Source File: ServerSOAPHandlerTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #7
Source File: ClientSOAPHandlerTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #8
Source File: ServerSOAPHandlerTube.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #9
Source File: ClientSOAPHandlerTube.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #10
Source File: ClientSOAPHandlerTube.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #11
Source File: ClientSOAPHandlerTube.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #12
Source File: ServerSOAPHandlerTube.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #13
Source File: ClientSOAPHandlerTube.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #14
Source File: ServerSOAPHandlerTube.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #15
Source File: ClientSOAPHandlerTube.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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<Handler>();
            HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
            List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
            if (!soapSnapShot.isEmpty()) {
                handlers.addAll(soapSnapShot);
                roles = new HashSet<String>();
                roles.addAll(handlerConfig.getRoles());
                processor = new SOAPHandlerProcessor(true, this, getBinding(), handlers);
            }
    }
}
 
Example #16
Source File: SOAPHandlerFaultOutInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Set<QName> getUnderstoodHeaders() {
    Set<QName> understood = new HashSet<>();
    for (Handler<?> h : getBinding().getHandlerChain()) {
        if (h instanceof SOAPHandler) {
            Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders());
            if (headers != null) {
                understood.addAll(headers);
            }
        }
    }
    return understood;
}
 
Example #17
Source File: SOAPHandlerInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Set<QName> getUnderstoodHeaders() {
    Set<QName> understood = new HashSet<>();
    for (Handler<?> h : getBinding().getHandlerChain()) {
        if (h instanceof SOAPHandler) {
            Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders());
            if (headers != null) {
                understood.addAll(headers);
            }
        }
    }
    return understood;
}
 
Example #18
Source File: SOAPHandlerFaultInInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Set<QName> getUnderstoodHeaders() {
    Set<QName> understood = new HashSet<>();
    for (Handler<?> h : getBinding().getHandlerChain()) {
        if (h instanceof SOAPHandler) {
            Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders());
            if (headers != null) {
                understood.addAll(headers);
            }
        }
    }
    return understood;
}
 
Example #19
Source File: ServerSOAPHandlerTube.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    HandlerConfiguration handlerConfig = ((BindingImpl) getBinding()).getHandlerConfig();
    List<SOAPHandler> soapSnapShot= handlerConfig.getSoapHandlers();
    if (!soapSnapShot.isEmpty()) {
        handlers.addAll(soapSnapShot);
        roles = new HashSet<String>();
        roles.addAll(handlerConfig.getRoles());
    }
}
 
Example #20
Source File: HandlerChain.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
public List<SOAPHandler<?>> getHandlers(HandlerPosition position) {
   return (List)this.registeredHandlers.get(position);
}
 
Example #21
Source File: JaxWsClientTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testSoapHandler() {
    URL url = getClass().getResource("/wsdl/hello_world.wsdl");
    javax.xml.ws.Service s = javax.xml.ws.Service
        .create(url, SERVICE_NAME);
    Greeter greeter = s.getPort(PORT_NAME, Greeter.class);
    d.setMessageObserver(new MessageReplayObserver("sayHiResponse.xml"));

    @SuppressWarnings("rawtypes")
    List<Handler> chain = ((BindingProvider)greeter).getBinding().getHandlerChain();
    chain.add(new SOAPHandler<SOAPMessageContext>() {

            public boolean handleMessage(SOAPMessageContext context) {

                Boolean outbound = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
                if (outbound) {
                    headers = CastUtils.cast((Map<?, ?>) context.get(MessageContext.HTTP_REQUEST_HEADERS));
                    if (headers == null) {
                        headers = new HashMap<>();
                        context.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
                    }
                    headers.put("My-Custom-Header", Collections.singletonList("value"));
                }
                return true;
            }

            public boolean handleFault(SOAPMessageContext smc) {
                return true;
            }

            public Set<QName> getHeaders() {
                return null;
            }

            public void close(MessageContext messageContext) {
            }
    });
    ((BindingProvider)greeter).getBinding().setHandlerChain(chain);

    String response = greeter.sayHi();
    assertNotNull(response);
    assertTrue("custom header should be present", headers.containsKey("My-Custom-Header"));
    assertTrue("existing SOAPAction header should not be removed", headers.containsKey("SOAPAction"));

}
 
Example #22
Source File: HandlerConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public List<SOAPHandler> getSoapHandlers() {
    return soapHandlers;
}
 
Example #23
Source File: HandlerChain.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
/** @deprecated */
@Deprecated
public HandlerChain registerHandler(HandlerPosition position, SOAPHandler<?> handler) {
   return this.register(position, handler);
}
 
Example #24
Source File: HandlerConfiguration.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public List<SOAPHandler> getSoapHandlers() {
    return soapHandlers;
}
 
Example #25
Source File: HandlerChain.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
public HandlerChain register(HandlerPosition position, SOAPHandler<?> handler) {
   List<SOAPHandler<?>> resultHandler = (List)this.registeredHandlers.get(position);
   resultHandler.add(handler);
   return this;
}
 
Example #26
Source File: HandlerChain.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
public HandlerChain unregisterHandler(HandlerPosition position, SOAPHandler<?> handler) {
   List<SOAPHandler<?>> resultHandler = (List)this.registeredHandlers.get(position);
   resultHandler.remove(handler);
   return this;
}
 
Example #27
Source File: HandlerConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public List<SOAPHandler> getSoapHandlers() {
    return soapHandlers;
}
 
Example #28
Source File: HandlerChain.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
public List<SOAPHandler<?>> getHandlers(HandlerPosition position) {
   return (List)this.registeredHandlers.get(position);
}
 
Example #29
Source File: HandlerChain.java    From freehealth-connector with GNU Affero General Public License v3.0 4 votes vote down vote up
/** @deprecated */
@Deprecated
public HandlerChain registerHandler(HandlerPosition position, SOAPHandler<?> handler) {
   return this.register(position, handler);
}
 
Example #30
Source File: HandlerConfiguration.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public List<SOAPHandler> getSoapHandlers() {
    return soapHandlers;
}