Package org.apache.cxf.endpoint

# Class ClientImpl

java.lang.Object
org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
org.apache.cxf.endpoint.ClientImpl

All Implemented Interfaces:
  `AutoCloseable`, `Client`, `ConduitSelectorHolder`, `Retryable`, `InterceptorProvider`, `MessageObserver`

public class ClientImpl extends AbstractBasicInterceptorProvider implements Client, Retryable, MessageObserver

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `ClientImpl.EchoContext`
  `class`
  `ClientImpl.IllegalEmptyResponseException`

  ## Nested classes/interfaces inherited from interface org.apache.cxf.endpoint.Client

  `Client.Contexts`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Bus`
  `bus`
  `protected ConduitSelector`
  `conduitSelector`
  `protected Map<String,Object>`
  `currentRequestContext`
  `protected Executor`
  `executor`
  `static final String`
  `FINISHED`
  `protected PhaseChainCache`
  `inboundChainCache`
  `protected Thread`
  `latestContextThread`
  `protected PhaseChainCache`
  `outboundChainCache`
  `protected ClientOutFaultObserver`
  `outFaultObserver`
  `protected Map<Thread,ClientImpl.EchoContext>`
  `requestContext`
  `protected Map<Thread,org.apache.cxf.endpoint.ClientImpl.ResponseContext>`
  `responseContext`
  `static final String`
  `SYNC_TIMEOUT`
  When a synchronous request/response invoke is done using an asynchronous transport mechanism, this is the timeout used for waiting for the response.
  `protected int`
  `synchronousTimeout`
  `static final String`
  `THREAD_LOCAL_REQUEST_CONTEXT`

  ### Fields inherited from interface org.apache.cxf.endpoint.Client

  `KEEP_CONDUIT_ALIVE, REQUEST_CONTEXT, RESPONSE_CONTEXT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClientImpl(Bus b, Endpoint e)`
  `ClientImpl(Bus b, Endpoint e, ConduitSelector sc)`
  `ClientImpl(Bus b, Endpoint e, Conduit c)`
  `ClientImpl(Bus bus, Service svc, QName port, EndpointImplFactory endpointImplFactory)`
  Create a Client that uses a specific EndpointImpl.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `void`
  `destroy()`
  Indicates that the client is no longer needed and that any resources it holds can now be freed.
  `Bus`
  `getBus()`
  Retrieves the Bus that was used to create the Client
  `Conduit`
  `getConduit()`
  Get the Conduit that messages for this client will be sent on.
  `final ConduitSelector`
  `getConduitSelector()`
  Get the ConduitSelector responsible for retreiving the Conduit.
  `protected final ConduitSelector`
  `getConduitSelector(ConduitSelector override)`
  `Client.Contexts`
  `getContexts()`
  `Endpoint`
  `getEndpoint()`
  `protected Exception`
  `getException(Exchange exchange)`
  `Map<String,Object>`
  `getRequestContext()`
  Gets the request context used for future invocations
  `Map<String,Object>`
  `getResponseContext()`
  Gets the response context from the last invocation on this thread
  `int`
  `getSynchronousTimeout()`
  `Object[]`
  `invoke(String operationName, Object... params)`
  Invokes an operation synchronously
  `Object[]`
  `invoke(QName operationName, Object... params)`
  Invokes an operation synchronously
  `void`
  `invoke(ClientCallback callback, String operationName, Object... params)`
  Invokes an operation asynchronously
  `void`
  `invoke(ClientCallback callback, QName operationName, Object... params)`
  Invokes an operation asynchronously
  `void`
  `invoke(ClientCallback callback, BindingOperationInfo oi, Object... params)`
  Invokes an operation asynchronously
  `void`
  `invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context)`
  Invokes an operation asynchronously
  `void`
  `invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange)`
  Invokes an operation asynchronously
  `void`
  `invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Exchange exchange)`
  Invokes an operation asynchronously
  `Object[]`
  `invoke(BindingOperationInfo oi, Object... params)`
  Invokes an operation synchronously
  `Object[]`
  `invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context)`
  Invokes an operation synchronously
  `Object[]`
  `invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange)`
  Invokes an operation synchronously
  `Object[]`
  `invoke(BindingOperationInfo oi, Object[] params, Exchange exchange)`
  `Object[]`
  `invokeWrapped(String operationName, Object... params)`
  Invokes an operation synchronously
  `Object[]`
  `invokeWrapped(QName operationName, Object... params)`
  Invokes an operation synchronously
  `void`
  `invokeWrapped(ClientCallback callback, String operationName, Object... params)`
  Invokes an operation asynchronously
  `void`
  `invokeWrapped(ClientCallback callback, QName operationName, Object... params)`
  Invokes an operation asynchronously
  `boolean`
  `isThreadLocalRequestContext()`
  Checks if the Request context is thread local or global.
  `protected void`
  `modifyChain(InterceptorChain chain, Message ctx, boolean in)`
  `protected void`
  `modifyOnewayChain(InterceptorChain chain, Message ctx)`
  `protected void`
  `onewayOnly(Exchange exhange)`
  `void`
  `onMessage(Message message)`
  Called for an incoming message, i.e. where the content format(s) is/are source(s).
  `protected void`
  `prepareConduitSelector(Message message)`
  `protected Object[]`
  `processResult(Message message, Exchange exchange, BindingOperationInfo oi, Map<String,Object> resContext)`
  `void`
  `releaseThreadContexts()`
  `final void`
  `setConduitSelector(ConduitSelector selector)`
  Set the ConduitSelector responsible for retreiving the Conduit.
  `protected void`
  `setContext(Map<String,Object> ctx, Message message)`
  `protected void`
  `setEndpoint(Endpoint e)`
  `protected void`
  `setExchangeProperties(Exchange exchange, Endpoint endpoint, BindingOperationInfo boi)`
  `void`
  `setExecutor(Executor executor)`
  Sets the executor which is used to process Asynchronous responses.
  `protected void`
  `setOutMessageProperties(Message message, BindingOperationInfo boi)`
  `protected void`
  `setParameters(Object[] params, Message message)`
  `protected Map<String,Object>`
  `setResponseContext(Map<String,Object> ctx)`
  `void`
  `setSynchronousTimeout(int synchronousTimeout)`
  `void`
  `setThreadLocalRequestContext(boolean b)`
  Sets whether the request context is thread local or global to this client.
  `protected PhaseInterceptorChain`
  `setupInterceptorChain(Endpoint endpoint)`
  `protected void`
  `waitResponse(Exchange exchange)`

  ### Methods inherited from class org.apache.cxf.interceptor.AbstractBasicInterceptorProvider

  `getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptors`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.apache.cxf.interceptor.InterceptorProvider

  `getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors`

- ## Field Details

  - ### THREAD_LOCAL_REQUEST_CONTEXT

    public static final String THREAD_LOCAL_REQUEST_CONTEXT
    See Also:
      - Constant Field Values

  - ### SYNC_TIMEOUT

    public static final String SYNC_TIMEOUT
    When a synchronous request/response invoke is done using an asynchronous transport mechanism, this is the timeout used for waiting for the response. Default is 60 seconds.
    See Also:
      - Constant Field Values

  - ### FINISHED

    public static final String FINISHED
    See Also:
      - Constant Field Values

  - ### bus

    protected Bus bus

  - ### conduitSelector

    protected ConduitSelector conduitSelector

  - ### outFaultObserver

    protected ClientOutFaultObserver outFaultObserver

  - ### synchronousTimeout

    protected int synchronousTimeout

  - ### outboundChainCache

    protected PhaseChainCache outboundChainCache

  - ### inboundChainCache

    protected PhaseChainCache inboundChainCache

  - ### currentRequestContext

    protected Map<String,Object> currentRequestContext

  - ### latestContextThread

    protected Thread latestContextThread

  - ### requestContext

    protected Map<Thread,ClientImpl.EchoContext> requestContext

  - ### responseContext

    protected Map<Thread,org.apache.cxf.endpoint.ClientImpl.ResponseContext> responseContext

  - ### executor

    protected Executor executor

- ## Constructor Details

  - ### ClientImpl

    public ClientImpl(Bus b, Endpoint e)

  - ### ClientImpl

    public ClientImpl(Bus b, Endpoint e, Conduit c)

  - ### ClientImpl

    public ClientImpl(Bus b, Endpoint e, ConduitSelector sc)

  - ### ClientImpl

    public ClientImpl(Bus bus, Service svc, QName port, EndpointImplFactory endpointImplFactory)
    Create a Client that uses a specific EndpointImpl.
    Parameters:
      `bus` -
      `svc` -
      `port` -
      `endpointImplFactory` -

- ## Method Details

  - ### getBus

    public Bus getBus()
    Description copied from interface: `Client`
    Retrieves the Bus that was used to create the Client
    Specified by:
      `getBus` in interface `Client`
    Returns:
      the Bus

  - ### destroy

    public void destroy()
    Description copied from interface: `Client`
    Indicates that the client is no longer needed and that any resources it holds can now be freed.
    Specified by:
      `destroy` in interface `Client`

  - ### getEndpoint

    public Endpoint getEndpoint()
    Specified by:
      `getEndpoint` in interface `Client`

  - ### releaseThreadContexts

    public void releaseThreadContexts()

  - ### getContexts

    public Client.Contexts getContexts()
    Specified by:
      `getContexts` in interface `Client`

  - ### getRequestContext

    public Map<String,Object> getRequestContext()
    Description copied from interface: `Client`
    Gets the request context used for future invocations
    Specified by:
      `getRequestContext` in interface `Client`
    Returns:
      context The context

  - ### getResponseContext

    public Map<String,Object> getResponseContext()
    Description copied from interface: `Client`
    Gets the response context from the last invocation on this thread
    Specified by:
      `getResponseContext` in interface `Client`
    Returns:
      context The context

  - ### setResponseContext

    protected Map<String,Object> setResponseContext(Map<String,Object> ctx)

  - ### isThreadLocalRequestContext

    public boolean isThreadLocalRequestContext()
    Description copied from interface: `Client`
    Checks if the Request context is thread local or global.
    Specified by:
      `isThreadLocalRequestContext` in interface `Client`
    Returns:
      true if the request context is a thread local

  - ### setThreadLocalRequestContext

    public void setThreadLocalRequestContext(boolean b)
    Description copied from interface: `Client`
    Sets whether the request context is thread local or global to this client. By default, the request context is "global" in that any values set in the context are seen by all threads using this client. If set to true, the context is changed to be a ThreadLocal and values set are not seen by other threads.
    Specified by:
      `setThreadLocalRequestContext` in interface `Client`
    Parameters:
      `b` -

  - ### invoke

    public Object[] invoke(BindingOperationInfo oi, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation synchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `oi` - The operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
    Returns:
      The return values that matche the parts of the output message of the operation
    Throws:
      `Exception`

  - ### invoke

    public Object[] invoke(String operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation synchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `operationName` - The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
      `params` - The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
    Returns:
      The return values that matche the parts of the output message of the operation
    Throws:
      `Exception`

  - ### invoke

    public Object[] invoke(QName operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation synchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `operationName` - The name of the operation to be invoked
      `params` - The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
    Returns:
      The return values that matche the parts of the output message of the operation
    Throws:
      `Exception`

  - ### invokeWrapped

    public Object[] invokeWrapped(String operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation synchronously
    Specified by:
      `invokeWrapped` in interface `Client`
    Parameters:
      `operationName` - The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
      `params` - The params that matches the parts of the input message of the operation
    Returns:
      The return values that matche the parts of the output message of the operation
    Throws:
      `Exception`

  - ### invokeWrapped

    public Object[] invokeWrapped(QName operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation synchronously
    Specified by:
      `invokeWrapped` in interface `Client`
    Parameters:
      `operationName` - The name of the operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
    Returns:
      The return values that matche the parts of the output message of the operation
    Throws:
      `Exception`

  - ### invoke

    public Object[] invoke(BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception
    Throws:
      `Exception`

  - ### invoke

    public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context) throws Exception
    Description copied from interface: `Client`
    Invokes an operation synchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `oi` - The operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
      `context` - Optional (can be null) contextual information for the invocation
    Returns:
      The return values that matche the parts of the output message of the operation
    Throws:
      `Exception`

  - ### invoke

    public void invoke(ClientCallback callback, String operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `operationName` - The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
      `params` - The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
    Throws:
      `Exception`

  - ### invoke

    public void invoke(ClientCallback callback, QName operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `operationName` - The name of the operation to be invoked
      `params` - The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
    Throws:
      `Exception`

  - ### invokeWrapped

    public void invokeWrapped(ClientCallback callback, String operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invokeWrapped` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `operationName` - The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
      `params` - The params that matches the parts of the input message of the operation
    Throws:
      `Exception`

  - ### invokeWrapped

    public void invokeWrapped(ClientCallback callback, QName operationName, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invokeWrapped` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `operationName` - The name of the operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
    Throws:
      `Exception`

  - ### invoke

    public void invoke(ClientCallback callback, BindingOperationInfo oi, Object... params) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `oi` - The operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
    Throws:
      `Exception`

  - ### invoke

    public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `oi` - The operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
      `context` - contextual information for the invocation
    Throws:
      `Exception`

  - ### invoke

    public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `oi` - The operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
      `exchange` - The Exchange to be used for the invocation
    Throws:
      `Exception`

  - ### invoke

    public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception
    Description copied from interface: `Client`
    Invokes an operation asynchronously
    Specified by:
      `invoke` in interface `Client`
    Parameters:
      `callback` - The callback that is called when the response is ready
      `oi` - The operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
      `context` - Optional (can be null) contextual information for the invocation
      `exchange` - Optional (can be null) The Exchange to be used for the invocation
    Throws:
      `Exception`

  - ### invoke

    public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception
    Description copied from interface: `Client`
    Invokes an operation synchronously
    Specified by:
      `invoke` in interface `Client`
    Specified by:
      `invoke` in interface `Retryable`
    Parameters:
      `oi` - The operation to be invoked
      `params` - The params that matches the parts of the input message of the operation
      `context` - Optional (can be null) contextual information for the invocation
      `exchange` - The Exchange to be used for the invocation
    Returns:
      The return values that matche the parts of the output message of the operation
    Throws:
      `Exception`

  - ### processResult

    protected Object[] processResult(Message message, Exchange exchange, BindingOperationInfo oi, Map<String,Object> resContext) throws Exception
    Throws:
      `Exception`

  - ### onewayOnly

    protected void onewayOnly(Exchange exhange)

  - ### getException

    protected Exception getException(Exchange exchange)

  - ### setContext

    protected void setContext(Map<String,Object> ctx, Message message)

  - ### waitResponse

    protected void waitResponse(Exchange exchange) throws IOException
    Throws:
      `IOException`

  - ### setParameters

    protected void setParameters(Object[] params, Message message)

  - ### onMessage

    public void onMessage(Message message)
    Description copied from interface: `MessageObserver`
    Called for an incoming message, i.e. where the content format(s) is/are source(s).
    Specified by:
      `onMessage` in interface `MessageObserver`
    Parameters:
      `message` -

  - ### getConduit

    public Conduit getConduit()
    Description copied from interface: `Client`
    Get the Conduit that messages for this client will be sent on.
    Specified by:
      `getConduit` in interface `Client`
    Returns:
      Conduit

  - ### prepareConduitSelector

    protected void prepareConduitSelector(Message message)

  - ### setOutMessageProperties

    protected void setOutMessageProperties(Message message, BindingOperationInfo boi)

  - ### setExchangeProperties

    protected void setExchangeProperties(Exchange exchange, Endpoint endpoint, BindingOperationInfo boi)

  - ### setupInterceptorChain

    protected PhaseInterceptorChain setupInterceptorChain(Endpoint endpoint)

  - ### modifyChain

    protected void modifyChain(InterceptorChain chain, Message ctx, boolean in)

  - ### modifyOnewayChain

    protected void modifyOnewayChain(InterceptorChain chain, Message ctx)

  - ### setEndpoint

    protected void setEndpoint(Endpoint e)

  - ### getSynchronousTimeout

    public int getSynchronousTimeout()

  - ### setSynchronousTimeout

    public void setSynchronousTimeout(int synchronousTimeout)

  - ### getConduitSelector

    public final ConduitSelector getConduitSelector()
    Description copied from interface: `Client`
    Get the ConduitSelector responsible for retreiving the Conduit.
    Specified by:
      `getConduitSelector` in interface `Client`
    Specified by:
      `getConduitSelector` in interface `ConduitSelectorHolder`
    Returns:
      the current ConduitSelector

  - ### getConduitSelector

    protected final ConduitSelector getConduitSelector(ConduitSelector override)

  - ### setConduitSelector

    public final void setConduitSelector(ConduitSelector selector)
    Description copied from interface: `Client`
    Set the ConduitSelector responsible for retreiving the Conduit.
    Specified by:
      `setConduitSelector` in interface `Client`
    Specified by:
      `setConduitSelector` in interface `ConduitSelectorHolder`
    Parameters:
      `selector` - the ConduitSelector to use

  - ### close

    public void close() throws Exception
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `Exception`

  - ### setExecutor

    public void setExecutor(Executor executor)
    Description copied from interface: `Client`
    Sets the executor which is used to process Asynchronous responses. The default is to use the threads provided by the transport. (example: the JMS listener threads)
    Specified by:
      `setExecutor` in interface `Client`
    Parameters:
      `executor` -