cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <>
Subject Re: Writing my own transport
Date Wed, 07 May 2008 04:08:47 GMT

Depending on what you need to do, you may not need all of the below  

For example, the CachedXXXputStream stuff may not be necessary  
depending on your protocol and current stream implementations.   
Actually, in most cases, you DON'T want to use that.   Instead, use a  
subclass of the AbstractWrappedOutputStream or your own stuff.

The TransportFactory is technically not required either.   It depends  
on what you need to do.

If you only need to write a client to talk to an existing service, you  
need a Conduit and a ConduitInitiator.

Likewise, if you need to write a server only, you just need a  
Destination and DestinationFactory.   The TransportFactory is  
basically a convienience if you need both as it can be the  
ConduitInitiator and the DestinationFactory in on.

Most of the "Logic" occurs in the Conduit/Destination objects.    
Generally, the Conduit.prepare adds an OutputStream to the method that  
does a couple things:

1) On the first write, it will do whatever header processing stuff is  
needed.  For HTTP, it sets the HTTP headers.

2) On the close, it can do one of:
     a) wait for the response and call the listener directly.  The  
http conduit does this.  It's generally the faster way to do it in  
most cases.
     b) Just send the message if there is some other asyncronous way  
that the response will come in and have the message listener called.    
The local transport does this.

The AbstractWrappedOutputStream makes some of the above easier by  
providing callbacks for those events, but it can be any stream.


On May 6, 2008, at 9:24 PM, Freeman Fang wrote:

> Hi Marcel,
> Assume the transport you want to implement is AAA, basically you  
> need several class as below
> AAAConduit extends AbstractConduit,  kinda like  your transport client
> AAADestination extends AbstractDestination,  your transport  
> destination
> AAAConduitOutputStream extends CachedOutputStream, send out client  
> request, you should use your transport api to send out request in  
> this class
> AAADestinationOutputStream extends CachedOutputStream, send out  
> server response, you should use your transport api to send out  
> response in this class
> AAATransportFactory, factory to get Conduit and Destination, also  
> you need a transport_id to distinguash your transport
> You can take a look at org.apache.cxf.transport.jbi which should be  
> like your scenario
> Freeman
> Marcel Heemskerk wrote:
>> I have a service 'service1'  listening to HTTP. I would like be  
>> able to make
>> a new transport for this service, so i can use a propietary transport
>> protocol to receive the InputStream and send the OutputStream to. The
>> received message is SOAP, so i just want to send it into the CXF  
>> marshalling
>> layer to have deserialized to a SOAP header with  
>> and
>> SOAP response, etc...
>> It should be simple, because i want to re-use the existing 'service1'
>> binding, JAXB, etc. However, it does not seem obvious. I've been  
>> trying to
>> reverse engineer the JMS transport or HTTP transport but no luck so  
>> far.
>> Could someone point out to me the relevant files or a tutorial on  
>> this
>> matter?
>> Thanks,
>> Marcel

Daniel Kulp

View raw message