code: private JaxWsSoapContextHandler getContextHandlerFromClient(BindingProvider soapClient) {
      @SuppressWarnings("rawtypes") // getHandlerChain returns a list of raw Handler.
      List<Handler> handlers = soapClient.getBinding().getHandlerChain();
      for (Handler<?> handler : handlers) {
        if (handler instanceof JaxWsSoapContextHandler) {
          return (JaxWsSoapContextHandler) handler;
        }
      }
      throw new IllegalStateException("The SOAP client passed into the JaxWsHandler does not "
          + "have the necessary context handler on its binding chain.");
    }
docs: Extracts the {@link JaxWsSoapContextHandler} object from a SOAP client's
  handler chain.
  
  In the event that no {@code JaxWsSoapContextHandler} object could be found,
  this method throws an {@code IllegalStateException}.
  
  @param soapClient the JAX-WS soap client whose handler is needed
  @return the {@code JaxWsSoapContextHandler} handler in the given client's
  handler chain