Interface WebServiceClientFactory
WebServiceClient objects.- Since:
- 2.4.0
-
Method Summary
Modifier and TypeMethodDescriptionCreates aWebServiceClientfrom a URI.create(HttpClient httpClient) Creates aWebServiceClientfrom anHttpClient.create(HttpClient httpClient, int port) Creates aWebServiceClientfrom aHttpClientand port
-
Method Details
-
create
Creates aWebServiceClientfrom a URI.Uses the
URI.getHost(),URI.getPort()andURI.getPath()when creating the client. If an alternative port should be used, then one of the overloaded methods that takes aHttpClientshould be used. Thecreate(HttpClient)is useful when the port should be the default one of theHttpClient.getScheme(), namely 80 for HTTP and 443 for HTTPS. Using one of these overloads also allows the admin to configure the forwarding proxy and trust anchors (i.e., which Certificate Authorities) should be trusted when authenticating the SSL server.- Parameters:
uri- the URI, which for all practical purposes will be an absolute URL, where the request will be made to- Returns:
- a WebServiceClient that can communicate with the given URI using the default SSL context (including trust anchors) and no forwarding proxy
- Since:
- 3.0.0
-
create
Creates aWebServiceClientfrom anHttpClient.This overload allows an administrator to configure the HTTP client for use within their environment. These are settings such as:
- The scheme (HTTP or HTTPS),
- Authentication method,
- Client SSL key, and
- Trusted SSL servers.
When this method or
create(HttpClient, int)is used, the hostname will not be set (unlike when thecreate(URI)method is used and the hostname is gleaned from the URI). For this reason, it almost certainly required to callWebServiceClient.withHost(String)after creating the WebServiceClient, as in this example:WebServiceClient client = webServiceClientFactory.create(httpClient); client.withHost("api.example.com");The HttpClient can be obtained in a
RequestHandlerby adding such an object as a constructor argument. This will cause an object of that type to be injected into the class when it is instantiated. Alternatively, it can be obtained by adding a getter of that type to aPluginDescriptorof some kind (e.g., anAuthenticatorPluginDescriptor.- Parameters:
httpClient- the HttpClient that should be used when making web service calls- Returns:
- a WebServiceClient that can communicate with a service using the given HttpClient
- Since:
- 3.0.0
-
create
Creates aWebServiceClientfrom aHttpClientand port- Parameters:
httpClient- the HttpClient that should be used when making web service calls to a service with the given portport- the port on which the web service is listening- Returns:
- a WebServiceClient that can communicate with a service listening on the given port using the provided HttpClient
- Since:
- 3.0.0
- See Also:
-