servicemix-http
ServiceMix ships with a JBI compliant HTTP/SOAP binding component named servicemix-http.
Here are the main features:
- JBI compliant Binding Component
- Usable in a lightweight mode in servicemix.xml configuration files
- Integrated HTTP server based on Jetty 6
- HTTP Client using Jakarta Commons HTTP Client
- Highly performant and scalable using Jetty 6 continuations
- SOAP 1.1 and 1.2 support
- MIME attachments
- WS-Addressing support
- WSDL based and XBean based deployments
- Support for all MEPs as consumers or providers
Installation
Installing the servicemix-http component can be done in several ways:
- drop the installer zip in an hotdeploy directory monitored by ServiceMix
- using ant tasks
Note that when using ant tasks, the component is not started, you will have to start it manually using ant tasks or a console.
Configuration
Several parameters can be configured using a JMX console.
Configuration
Name |
Type |
Description |
Default |
---|---|---|---|
streamingEnabled |
boolean |
send client side requests using HTTP streaming |
false |
jettyConnectorClassName |
String |
Jetty connector class name |
org.mortbay.nio.SelectChannelConnector |
jettyThreadPoolSize |
int |
thread pool size for server side requests |
255 |
maxConnectionsPerHost |
int |
max number of simultaneous connections to a given host |
32 |
maxTotalConnections |
int |
max number of total simulatenous connections |
256 |
XBean deployment
You can deploy Service Units containing a file named xbean.xml for activating consumer and provider endpoints.
This xml file should respect the given syntax, though this is a spring based xml configuration file from where all beans of class HttpEndpoint are retrieved.
See a full example here. Note that you have to define the http namespace with
<beans xmlns:http="http://servicemix.apache.org/http/1.0"> ... </beans>
Any numbers of endpoints can be specified in the xbean.xml file.
Consumer endpoint
A consumer endpoint is a server-side http endpoint that will consumer plain HTTP, or HTTP+SOAP requests and send them into the NMR to a given JBI endpoint, which is called the proxied endpoint.
Following is an example of an http consumer endpoint.
Consumer endpoint attributes
Name |
Type |
Description |
Required |
---|---|---|---|
service |
QName |
the service name of the proxied endpoint |
|
endpoint |
String |
the endpoint name of the proxied endpoint |
|
interfaceName |
QName |
the interface name of the proxied endpoint |
|
role |
String |
must be 'consumer' |
yes |
locationURI |
URI |
the http url where this proxy endpoint will be exposed |
yes |
defaultMEP |
URI |
the default MEP uri to use |
no |
soap |
boolean |
if set, the component will parse the soap requests and send the content into the NMR |
no (defaults to false) |
soapVersion |
string |
can be set to '1.1' to force the use of SOAP 1.1 messages |
no |
wsdlResource |
if set, the wsdl will be retrieved from the given Spring resource |
no |
Provider endpoint
A provider endpoint is a client-side jbi endpoint which can receive requests from the NMR and send them to a given url where the service is provided.
Here is an example of an http provider endpoint:
Provider endpoint attributes
Name |
Type |
Description |
Required |
---|---|---|---|
service |
QName |
the service name of the exposed jbi endpoint |
yes |
endpoint |
String |
the endpoint name of the exposed jbi endpoint |
yes |
interfaceName |
QName |
the interface name of the exposed jbi endpoint |
no |
role |
String |
must be 'provider' |
yes |
locationURI |
URI |
the http url of the target service |
yes |
soap |
boolean |
if set, the component will parse the soap requests and send the content into the NMR |
no (defaults to false) |
wsdlResource |
if set, the wsdl will be retrieved from the given Spring resource |
no |
WSDL Deployment
In addition to xbean based deployment, the component accepts WSDL-based deployment.
The service unit may contain any number of WSDL files, each one being parsed and activating the specified endpoints.
To retrieve the necessary informations from the wsdl, the component can recognize a jbi extension, in addition to the standard http and soap bindings, which specified the role of the component and the default MEP to use for JBI exchanges.
Here is an example of a WSDL:
Lightweight mode
The servicemix-http component can also be configured in a spring/xbean configuration file, for use in an embedded ServiceMix.
Here is an example of such a configuration:
Accessing WSDLs
WSDLs for consumer endpoints are retrieved using the following method:
- for a WSDL based deployed endpoint, the WSL will be used as is
- for an XBean based deployed endpoint, the WSDL will be retrieved from the wsdlResource attribute
- if this information is not provided, the component will try to generate a WSDL by retrieving the target endpoint WSDL and adding the relevant informations to it.
WSDLs are accessible with the standard '?wsdl' query string.
For example, the WSDL for the consumer endpoint seen in the 'WSDL Deployment' section will be available at
http://localhost:8192/InOnly/?wsdl