The soapUI SOAPClient
and SOAPProxy
actions use Apache Commons HttpClient
in order to invoke the SOAP operation, it is common practice to specify a property
file which can be used to alter the behavior, for example by specifying security-related configuration or details of a proxy.
Both of these actions allow the location of this property file to be configured as a parameter, however there is a difference in how this is done. Let's take a look at the ways these properties can be specified.
This action allows a custom tag <http-client-property>
to specify the configuration through a file
attribute or explicitly through http-client-property
properties.
The file
attribute can refer to a configuration through:
ClassLoader
The following configuration shows a reference to a resource which is included in the deployment:
<action name="soapui-client-action"
class="org.jboss.soa.esb.actions.soap.SOAPClient">
<property name="wsdl" value="http://localhost:8080/Chapter8/ebws/Chapter8Sample/Chapter8Service?wsdl"/>
<property name="SOAPAction" value="Chapter8ServiceOp"/>
<http-client-property name="file" value="/http.properties"/>
</action>
Individual properties can also be set as follows:
<action name="soapui-client-action" class="org.jboss.soa.esb.actions.soap.SOAPClient"> ... <property name="http-client-properties> <http-client-property name="http.proxyHost" value="esbhost"/> <http-client-property name="http.proxyPort" value="808"/> </property> </action>
The SOAPProxy
action allows the file
attribute to be set via the <property>
tag. A sample configuration is shown:
<action class="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy"
name="proxy-action">
<property name="wsdl" value="internal://jboss.ws:context=BookService,endpoint=BookService"/>
<property name="file" value="/http.properties"/>
</action>
The following are some common properties specified in the HttpClient
properties file:
# See: # - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpRouter and # - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpClientFactory # Configurators #configurators=HttpProtocol,AuthBASIC configurators=HttpProtocol,AuthNTLM # HttpProtocol config #protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.StrictSSLProtocolSocketFactory protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory #protocol-socket-factory=org.jboss.soa.esb.http.protocol.SelfSignedSSLProtocolSocketFactoryBuilder #protocol-socket-factory=org.jboss.soa.esb.http.protocol.AuthSSLProtocolSocketFactoryBuilder keystore=@keystore@ [email protected]@ truststore=@keystore@ truststore-passw=webservice_proxy_security_pass # Connection config max-connections-per-host=5 # HttpProtocol config http.proxyHost=192.168.1.3 http.proxyPort=808 # AuthNTLM config ntauth-username=JBOSSTEST ntauth-password=JBOSSPASS ntauthscope-host=ESBHOST ntauthscope-port=80 ntauthscope-domain=JBOSS # AuthBASIC config auth-username=kermit auth-password=thefrog authscope-host=localhost authscope-port=8443 authscope-realm=webservice_proxy_security
The SOAPProxy
action can make use of an HttpClient
to invoke a remote endpoint. Occasionally it may be necessary to extend the configuration of this client class and enable some features which are not directly exposed by JBoss ESB. This can be achieved through the inclusion of a custom configurator, a simple class which can initialize the HttpClient
programmatically using the properties supplied to the action.
The following shows how to implement a simple configurator which does nothing more than log the fact that it has been invoked:
# Configurators configurators=HttpProtocol, org.jboss.soa.esb.samples.chapter8.MyConfigurator
The code for this configurator is shown here:
package org.jboss.soa.esb.samples.chapter8; import org.apache.commons.httpclient.HttpClient; import org.jboss.soa.esb.http.Configurator; import org.jboss.soa.esb.ConfigurationException; import org.apache.log4j.Logger; import java.util.Properties; public class MyConfigurator extends Configurator { private Logger log = Logger.getLogger(MyConfigurator.class); public void configure(HttpClient httpClient,Properties properties) throws ConfigurationException { System.out.println("MyConfigurator:: just logging entries!"); } }