You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Shaw, Richard A" <ri...@atkinsglobal.com> on 2008/02/13 10:44:45 UTC

Creating a custom bindings

Does anybody have any tips (where to start) on how to create a custom binding ?

I created a custom binding for the old Celtix to handle simple arrays of data in CSV format, this was used to load data from CSV files as if I had requested the data from a web service. It was very useful because I could change my data source to a web service instead of a CSV file without having to change my consumer code (just the WSDL File). 

The thing that I find most confusing is the different ways in which the bindings can be configured, wsdl, beans, etc.

I'll try to create a step by step record of what I do when I start. 

I also want to create an FTP transport which I created for the old Celtix before. I am assuming that most of the concepts for the binding will be similar for the transport.

If anybody is interested I have a requirement document which details how I use the WSDL file to define the mapping between a simple XML array of records and the rows of a CSV file (complete with header row).

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems 

Atkins Highways and Transportation 
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@atkinsglobal.com

www.atkinsglobal.com/its



This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.

The ultimate parent company of the Atkins Group is WS Atkins plc.  Registered in England No. 1885586.  Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18 5BW. A list of wholly owned Atkins Group companies registered in the United Kingdom can be found at http://www.atkinsglobal.com/terms_and_conditions/index.aspx

Consider the environment. Please don't print this e-mail unless you really need to.

Re: Creating a custom bindings

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 13 February 2008, Shaw, Richard A wrote:
> Does anybody have any tips (where to start) on how to create a custom
> binding ?

Wow.   That's a big undertaking, but very cool to see.  :-)

Basically, for bindings, you need to create 
XmlStreamReader/XmlStreamWriter objects that will produce/consume the 
appropriate Xml events, but based on your binding instead of XML.   
That's usually the hardest part.    Your binding would mostly just be a 
those readers/writers and an interceptor that would take the 
Input/OutputStreams from the message and wrapper them with the 
XmlStreamReader/Writers.   Then let the rest of the CXF interceptors do 
the remaining work.   

The easiest way to see how that would work is to use JAXB or something to 
generate code from the schema and then pass a "debug" version of 
XmlStreamWriter into JAXB to see what events it would generate.   You 
would just need to handle the same events.


> I created a custom binding for the old Celtix to handle simple arrays
> of data in CSV format, this was used to load data from CSV files as if
> I had requested the data from a web service. It was very useful
> because I could change my data source to a web service instead of a
> CSV file without having to change my consumer code (just the WSDL
> File).
>
> The thing that I find most confusing is the different ways in which
> the bindings can be configured, wsdl, beans, etc.
>
> I'll try to create a step by step record of what I do when I start.
>
> I also want to create an FTP transport which I created for the old
> Celtix before. I am assuming that most of the concepts for the binding
> will be similar for the transport.

Transports are, for the most part, much easier.   If you don't need to 
deal with WS-RM/WS-A decoupled responses, it's pretty simple.   Just get 
the streams, create a Message, and call on the listener.

Dan


> If anybody is interested I have a requirement document which details
> how I use the WSDL file to define the mapping between a simple XML
> array of records and the rows of a CSV file (complete with header
> row).
>
> Richard Shaw
>
> ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤
>
> Richard Shaw
> Technical Design Authority - Information Solutions Consultancy
> Intelligent Transport Systems
>
> Atkins Highways and Transportation
> Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW
>
> Tel: +44 (0) 1372 756407
> Fax: +44 (0) 1372 740055
> Mob: 07740 817586
> E-mail: richard.shaw@atkinsglobal.com
>
> www.atkinsglobal.com/its
>
>
>
> This email and any attached files are confidential and copyright
> protected. If you are not the addressee, any dissemination of this
> communication is strictly prohibited. Unless otherwise expressly
> agreed in writing, nothing stated in this communication shall be
> legally binding.
>
> The ultimate parent company of the Atkins Group is WS Atkins plc. 
> Registered in England No. 1885586.  Registered Office Woodcote Grove,
> Ashley Road, Epsom, Surrey KT18 5BW. A list of wholly owned Atkins
> Group companies registered in the United Kingdom can be found at
> http://www.atkinsglobal.com/terms_and_conditions/index.aspx
>
> Consider the environment. Please don't print this e-mail unless you
> really need to.



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog