Configure JBoss WS on a multiple network interfaces

The JBoss WebServices package is a nice library to get your webservice kickstarted in no-time. One of its features is the automatic generation of a WSDL for your webservice endpoint. There is however a slight annoyance when you try to use this on a machine with two network interfaces.

On a single interface machine, JBoss automatically fills in the IP address or hostname of that interface in the <soap:address/> WSDL entry. No problems there. But, if you have a machine with two interfaces, for example one for internal and one for external access, then JBoss is likely to screw things up.

This is due to the following configuration directive in the jbossas/server/production/deploy/jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml:

<property name="webServiceHost">${jboss.bind.address}</property>

This property causes JBoss to use the bind address in the WSDL rewriting/generation. Even if you start the server with -b, which binds it to all interfaces, JBoss still selects a single interface to use in this property.

The solution to this is luckily very simple: if this property is removed from the configuration file, JBoss will rewrite the WSDL with the address of the interface on which the request came in.

It does make me wonder, why is this not the default setting? Would it not be easier to drop in a server anywhere and it automatically exposes correct WSDL files on all interfaces? Then, if you want to restrict it to a single interface, add the property shown above.

Posted in Java EE.