[[Configuring_other_clients_using_wildfly-config]]
= Client configuration using wildfly-config.xml

ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]

Prior to WildFly 11, many WildFly client libraries used different configuration strategies. WildFly 11 introduces a new `wildfly-config.xml` file which unifies all client configuration in a single place. In addition to being able to configure authentication using Elytron as described in the previous section, a `wildfly-config.xml` file can also be used to:

== Configure Jakarta Enterprise Beans client connections, global interceptors, and invocation timeout

Schema location: [https://github.com/wildfly/jboss-ejb-client/blob/4.0.2.Final/src/main/resources/schema/wildfly-client-ejb_3_0.xsd]

Example configuration:

.wildfly-config.xml
[source,xml,options="nowrap"]
----
<configuration>
...
    <jboss-ejb-client xmlns="urn:jboss:wildfly-client-ejb:3.0">
        <invocation-timeout seconds="10"/>
        <connections>
            <connection uri="remote+http://10.20.30.40:8080"/>
        </connections>
        <global-interceptors>
            <interceptor class="org.jboss.example.ExampleInterceptor"/>
        </global-interceptors>
    </jboss-ejb-client>
...
</configuration>
----

== Configure HTTP client

Schema location:[https://github.com/wildfly/wildfly-http-client/blob/1.0.2.Final/common/src/main/resources/schema/wildfly-http-client_1_0.xsd]

Example configuration:

.wildfly-config.xml
[source,xml,options="nowrap"]
----
<configuration>
...
    <http-client xmlns="urn:wildfly-http-client:1.0">
        <defaults>
            <eagerly-acquire-session value="true" />
            <buffer-pool buffer-size="2000" max-size="10" direct="true" thread-local-size="1" />
        </defaults>
    </http-client>
...
</configuration>
----


== Configure a remoting endpoint

Schema location:[https://github.com/jboss-remoting/jboss-remoting/blob/5.0.1.Final/src/main/resources/schema/jboss-remoting_5_0.xsd]

Example configuration:

.wildfly-config.xml
[source,xml,options="nowrap"]
----
<configuration>
...
    <endpoint xmlns="urn:jboss-remoting:5.0">
        <connections>
            <connection destination="remote+http://10.20.30.40:8080" read-timeout="50" write-timeout="50" heartbeat-interval="10000"/>
        </connections>
    </endpoint>
...
</configuration>
----

== Configure the default XNIO worker

Schema location:[https://github.com/xnio/xnio/blob/3.5.1.Final/api/src/main/resources/schema/xnio_3_5.xsd]

Example configuration:

*wildfly-config.xml*
[source,xml,options="nowrap"]
----
<configuration>
...
    <worker xmlns="urn:xnio:3.5">
        <io-threads value="10"/>
        <task-keepalive value="100"/>
        <stack-size value="5000"/>
    </worker>
...
</configuration>
----

== Configure RESTEasy client

RESTEasy client will automatically load credentials, bearer token and SSL context from `wildfly-config.xml`. Credentials will be used for HTTP Basic authentication and bearer token for Bearer token authentication.

Example configuration:

*wildfly-config.xml*
[source,xml,options="nowrap"]
----
<configuration>
    <authentication-client xmlns="urn:elytron:client:1.4">
    ...
        <set-user-name name="administrator" />
        <credentials>
            <bearer-token value="bearerTokenValue"/>
        </credentials>
        <key-stores>
            <key-store name="truststore" type="PKCS12">
                <file name="src/test/resources/org/jboss/resteasy/test/security/client-different-cert.truststore"/>
            </key-store>
        </key-stores>
        <ssl-contexts>
            <ssl-context name="client-context">
                <trust-store key-store-name="truststore"/>
            </ssl-context>
        </ssl-contexts>
        <ssl-context-rules>
            <rule use-ssl-context="client-context"/>
        </ssl-context-rules>
    ...
    </authentication-client>
</configuration>
----

[NOTE]
Note that WildFly client libraries do have reasonable default configuration. Thus, adding configuration for these clients to `wildfly-config.xml` isn’t mandatory.
