Metro In-VM Transport

In-VM local transport allows TCP loop-back like SOAP communication between the client and the server in the same virtual machine. It is primarily designed to enable testing of web service endpoints without using a fully-fledged web container.

Using Maven

In your pom file you would need to add in-vm transport to the test classpath and after calling Wsgen and Wsimport you can use it in your tests.


See the sample maven pom.xml and the complete maven based sample here.

Using Ant

In your ant build file you would need to define classpath to include Metro jars and call Wsimport and Wsgen targets.

 <!-- setup Metro runtime classpath -->
<path id="runtime.cp">
    <fileset dir="${lib.home}" includes="*.jar" excludes="webservices-tools.jar"/>
    <fileset dir="${basedir}/../lib" includes="invm-transport.jar"/>
    <pathelement location="${build.classes}"/>

<!-- setup Metro tooltime classpath -->
<path id="tool.cp">
    <path refid="runtime.cp"/>
    <pathelement location="${lib.home}/webservices-tools.jar"/>

<!-- Setup Wsimport ant task. You would use this task in WSDL to Java case
to compile a WSDL and generate Java classes.
<taskdef name="wsimport" classname="">
    <classpath refid="tool.cp"/>

<!-- Setup Wsgen ant task. You would use this task in Java to WSDL case to
generate a WSDL or wrapper classes.
<taskdef name="wsgen" classname="">
    <classpath refid="tool.cp"/>

See the sample ant build script and the complete ant based sample here.

Using Spring

To use this transport with , you need to declare one more namespace URI:

<beans ...
Then you can export a bunch of services by using an ID of your choice:
<wsl:bindings id="test-local-endpoint">

    <ws:service ... />       <!-- either define a service inline -->
    <ref bean="myService" /> <!-- or refer to another bean -->
These services can be accessed by setting the endpoint address URI as in-vm://test-local-endpoint/ (the spring bean ID becomes a part of the URI.) If multiple endpoints are deployed in a single local transport server, you can distinguish them by using the local name of the port QName as the query parameter, like ?port1

Source Repository

In-Vm transport code lives in JAX-WS RI code base. The module in the JAX-WS RI sources is transport/local.


You can get the In-Vm transport jar from here and put in the Metro or JAX-WS RI classpath, tryout and let us know.

Terms of Use; Privacy Policy; Copyright ©2013-2017 (revision 20160708.bf2ac18)
Please Confirm