Skip to main content

JAX-WS transports

Posted by jitu on August 17, 2006 at 10:19 AM PDT

Now, JAX-WS RI(2.0.1 M1) has much better support for plugging-in custom transports. Oleksiy blogged about this in How to create custom network transport for JAX-WS. Note that the links are referring to older source versions and since then some classes have changed.




In the source repository, there is local transport which comes in handy while developing and debugging. Note that this is a proprietary transport and is not supported. In this transport, both client and server are running in the same VM and the communication doesn't happen over HTTP. Ofcourse, if your endpoint uses some servlet functionality like Session or something, then this of no use.

If the endpoint address's scheme is "local", LocalTransportFactory creates a LocalTransportPipe. The only requirement is WSDL should contain port address in the form of local:///XXX?portName where XXX is the dir that contains WEB-INF/sun-jaxws.xml. The transport pipe parses sun-jaxws.xml and figures out the corresponding endpoint and invokes it.

public final class LocalTransportFactory extends TransportPipeFactory {
    public Pipe doCreate(lientPipeAssemblerContext context) {
        URI adrs = context.getAddress().getURI();
        if(!adrs.getScheme().equals("local"))
            return null;

        return new LocalTransportPipe(createServerService(adrs),context.getBinding());
    }

I am attaching a sample which uses this transport. To run

  • keep all the latest jax-ws jars in lib dir, including jaxws-local-transport.jar
  • Change the address location in wsdl/RpcLitEndpoint.wsdl to reflect dir


    For e.g:
    soap:address location="local:///XXX/build?RpcLitPort"

  • Do run.sh