ServiceMix provides several binding components that use the Java API for XML-based Web Services (JAX-WS API). The ServiceMix JAX-WS components can invoke a web service client or can host a Java-based web service and expose it over multiple protocols. We currently test against the JAX-WS RI and plan to test against Celtix.
Making a Web Service Invocation Through JBI
The JBI binding for JAX-WS allows the JAX-WS API to invoke a web service from a JBI message, i.e., the binding component uses JAX-WS to act as a web service client. The following example shows how to configure a service as a JAX-WS client:
Error formatting macro: snippet: java.lang.IllegalArgumentException: Invalid url: must begin with a configured prefix.
To automatically generate the service and the client, point to the WSDL file. The above assumes the WSDL has only a single port available; if a WSDL exposes multiple ports then you must also supply the port QName.
Hosting a JAX-WS Service Inside ServiceMix
The other option is to host the actual Java and JAX-WS based web service implementation inside ServiceMix and then to expose it as an endpoint over one or more transport protocols.
Error formatting macro: snippet: java.lang.IllegalArgumentException: Invalid url: must begin with a configured prefix.
The JAX-WS service needs to be defined with JAX-WS annotations as follows:
Error formatting macro: snippet: java.lang.IllegalArgumentException: Invalid url: must begin with a configured prefix.
The "@" annotation allows programmers to avoid writing boilerplate code. For example, @Webservice is a shorthand notation that specificies this class is a Web Service. Tools that understand the notation, such as the apt tool in Java 1.5, will automatically generate the Web service artifacts including the WSDL file. This annotation is described in JSR 181.
Location of the ServiceMix JAX WS Components
- The source code for the ServiceMix 2.0.x JAX WS components can be found at:
[servicemix_src_install_dir]\components\jaxws\src\main\java\org\servicemix\components\jaxws
where [servicemix_src_install_dir] is the directory in which ServiceMix is installed.
Additional Resources
- JAX-WS - JSR 224 Specification