The HttpClient is library which is support by apache. It can post or get data from specific webservice and represents only the most basic contract for HTTP request execution. We explain how to use this library with a example. In this example, we are going to use it to access the google tranlated API. Apache HttpClient - Proxy Authentication - In this chapter, we will learn how to create a HttpRequest authenticated using username and password and tunnel it through a proxy to a target host, using an ex. In this case, a client from the local machine (::1) is being denied access to /var/www/example.com. First, remember 'Directory' permissions propagate to subdirectories by default. The possible causes are: Access was denied due to an explicit deny (2.2) directive or require (2.4) directive in a directory block or.htaccess file.
- Apache Http Client Https Proxy
- Apache Http Client Proxy List
- Apache Http Client Proxy
- Apache Http Client Socks Proxy
CXF provides you with many options to build clients for your services. This guide is meant to give you a quick overview of those options and help you orient yourself quickly with CXF.
- Building Clients
WSDL2Java generated Client
One of the most common scenarios is that where you have a service which you may or not manage and this service has a WSDL. In this case you'll often want to generate a client from the WSDL. This provides you with a strongly typed interface by which to interact with the service. Once you've generated a client, typical usage of it will look like so:
The WSDL2Java tool will generate JAX-WS clients from your WSDL. You can run WSDL2java one of three ways:
- With the WSDL2Java API
For more in depth information read Developing a JAX-WS consumer or see the Hello World demos inside the distribution.
JAX-WS Proxy
Instead of using a wsdl2java-generated stub client directly, you can use Service.create to create Service instances, the following code illustrates this process:
Apache Http Client Https Proxy
JAX-WS Dispatch APIs
JAX-WS provides the 'dispatch' mechanism which makes it easy to dynamically invoke services which you have not generated a client for. Using the Dispatch mechanism you can create messages (which can be JAXB objects, Source objects, or a SAAJMessage) and dispatch them to the server. A simple example might look like this:
NOTE: you can also use dispatches without a WSDL.

For more in depth information see the Hello World demos inside the distribution.
Simple Frontend Client Proxy
If you've developed a service using the simple frontend, you can use the ClientProxyFactoryBean API to create a Java proxy client for your service. This way you can use the service interface to talk to your service. For more information see the Simple Frontend documentation.
Dynamic Client
CXF includes a Client interface which allows you to invoke operations and pass parameters for those operations. For instance:
Apache Http Client Proxy List
There are two ways to create Clients at runtime. The first choice is to use the ClientFactoryBean or JaxWsClientFactoryBean classes. These will create proxy objects for the SEI for the service. These proxies cannot handle complex objects.

The second to use the DynamicClientFactory or one of its subclasses. The DynamicClientFactory goes the additional step of generating and compiling JAXB POJOs for complex objects described in the WSDL, for use at runtime via reflection.
Apache Http Client Proxy
This is most useful when you're using a dynamic language such as Groovy with CXF, but it is possible to use reflection directly from Java.
Apache Http Client Socks Proxy
More Information: Dynamic Clients
