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 2007/06/01 17:33:16 UTC

Skipping some layers in the interceptor chain

I have the following requirement and was wondering whether anybody could tell me if it is possible -

1 - I have an XML string which represents the logical message for a request
2 - I want to use this to make a request on an appropriate service 
3 - I want to catch the reply at the XML level without creating a java object
4 - transform the reply using a XSL stylesheet to be the logical message of another service
5 - send the logical message to the final service

This is for a generic data fetch. It requests data from a SOA component, transforms the data into a set message, which is sent to my datastore component. I don't want to write a new component for every type of data source that I want to fetch data from.

I have implemented the above using the original Celtix code, but it has the following inefficiencies -

1 - I load the XML from my config. unmarshal it into an object and then use that to call my service which will marshal as its first step
3 - the response is unmarshalled into a java object so I then marshal it back to an XML stream to pass to the XSLT transformer
5 - I unmarshal the transformed XML into a java object and use that to call my data storage service

Thanks

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.

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

CXF & Orbeon Forms

Posted by "Shaw, Richard A" <ri...@atkinsglobal.com>.
I was surprised to see that you have spotted me on both mailing lists.

I am using CXF to build my web service components and to connect to some legacy services. I am using Orbeon Forms to create my client web interfaces and using the pipelines to call my CXF services.

Integrating them probably implies more than I am doing. It's an interesting idea to create an orbeon pipeline processor which would use CXF to connect to a service thus enabling other transport and bindings to be used. 

It might also be interesting to see if the Orbeon pipeline processor could be used as an orchestration engine for CXF services. The only trouble with this is that there isn't a graphical tool to create the pipelines like there is with BPEL engines. But I have to say that I've found using the Orbeon pipelines much easier than BPEL.

I've copied this to the Orbeon mailing list to see if anybody else has though about this.

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

-----Original Message-----
From: Dan Connelly [mailto:daniel.s.connelly@comcast.net] 
Sent: 02 June 2007 08:15
To: cxf-user@incubator.apache.org
Subject: Re: Skipping some layers in the interceptor chain

Richard:

I have been thinking of using the SourceDataBinding for a similar use 
case.     Have you tried that?   Does it avoid the inefficiency?

I have not tried this myself yet, so I raise it out of curiosity.   
Please post your experience.

(Can I assume that you are integrating CXF with Orbeon since you are active on that list as well?)

       -- Dan Connelly


Shaw, Richard A wrote:
> I have the following requirement and was wondering whether anybody 
> could tell me if it is possible -
>
> 1 - I have an XML string which represents the logical message for a 
> request
> 2 - I want to use this to make a request on an appropriate service
> 3 - I want to catch the reply at the XML level without creating a java 
> object
> 4 - transform the reply using a XSL stylesheet to be the logical 
> message of another service
> 5 - send the logical message to the final service
>
> This is for a generic data fetch. It requests data from a SOA component, transforms the data into a set message, which is sent to my datastore component. I don't want to write a new component for every type of data source that I want to fetch data from.
>
> I have implemented the above using the original Celtix code, but it 
> has the following inefficiencies -
>
> 1 - I load the XML from my config. unmarshal it into an object and 
> then use that to call my service which will marshal as its first step
> 3 - the response is unmarshalled into a java object so I then marshal 
> it back to an XML stream to pass to the XSLT transformer
> 5 - I unmarshal the transformed XML into a java object and use that to 
> call my data storage service
>
> Thanks
>
> 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.
>
> Consider the environment. Please don't print this e-mail unless you really need to. 
>
>   



This message has been scanned for viruses by MailControl - (see http://bluepages.wsatkins.co.uk/?6875772)

Re: Skipping some layers in the interceptor chain

Posted by Dan Connelly <da...@comcast.net>.
Richard:

I have been thinking of using the SourceDataBinding for a similar use 
case.     Have you tried that?   Does it avoid the inefficiency?

I have not tried this myself yet, so I raise it out of curiosity.   
Please post your experience.

(Can I assume that you are integrating CXF with Orbeon since you are 
active on that list as well?)

       -- Dan Connelly


Shaw, Richard A wrote:
> I have the following requirement and was wondering whether anybody could tell me if it is possible -
>
> 1 - I have an XML string which represents the logical message for a request
> 2 - I want to use this to make a request on an appropriate service 
> 3 - I want to catch the reply at the XML level without creating a java object
> 4 - transform the reply using a XSL stylesheet to be the logical message of another service
> 5 - send the logical message to the final service
>
> This is for a generic data fetch. It requests data from a SOA component, transforms the data into a set message, which is sent to my datastore component. I don't want to write a new component for every type of data source that I want to fetch data from.
>
> I have implemented the above using the original Celtix code, but it has the following inefficiencies -
>
> 1 - I load the XML from my config. unmarshal it into an object and then use that to call my service which will marshal as its first step
> 3 - the response is unmarshalled into a java object so I then marshal it back to an XML stream to pass to the XSLT transformer
> 5 - I unmarshal the transformed XML into a java object and use that to call my data storage service
>
> Thanks
>
> 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.
>
> Consider the environment. Please don't print this e-mail unless you really need to. 
>
>   


RE: Skipping some layers in the interceptor chain

Posted by "Liu, Jervis" <jl...@iona.com>.

> -----Original Message-----
> From: Dan Diephouse [mailto:dan@envoisolutions.com]
> Sent: 2007?6?6? 5:40
> To: cxf-user@incubator.apache.org
> Subject: Re: Skipping some layers in the interceptor chain
> 
> 
> Ugh please no :-D
> 
> I'd recommend taking a look at the JAX-WS provider/dispatch 
> mechanisms. You
> can send a Source object via the Dispatch (and it will wrap 
> it with a SOAP
> body if necessary or handle whatever binding stuff needs to 
> happen). On the
> server side you can then receive the XML via a Provider. Once 
> again you'll
> get a Source object which should be easy enough to work with.
> 
> I believe there are some ok samples here:
> 
> http://java.sun.com/mailers/techtips/enterprise/2006/TechTips_
> July06.html
> 
> - Dan
> 
> On 6/5/07, Dan Connelly <da...@comcast.net> wrote:
> >
> > The most straight-forward (but moderately inefficient) way 
> to process
> > XML messages within SOAP is to have a service method that merely
> > exchanges Request-Response XMLs (Strings byte[ ]s),. like so in the
> > service Interface:
> >
> > public interface String getResponse(String myRequestAsXml) ;
> >
> > Implement the service in XSL transforms.
> >
> > For real-life XML "eFile" messaging service see :
> > http://www.streamlinedsalestax.org/EFileService-1.0.1.wsdl
> >
> >
> >
> > Shaw, Richard A wrote:
> > > I'm not sure if we are talking at cross purposes here. So 
> I'll give an
> > example -
> > >
> > > My logical message is -
> > >
> > > <AddNumbers>
> > >       <First>10</First>
> > >       <Second>20</Second>
> > > </AddNumbers>
> > >
> > > I want to call a Dispatch and pass in the XML as above.
> > >
> > > If I set the binding in my wsdl file to be pure XML, I 
> expect to see the
> > XML above passed over the transport.
> > >
> > > If I changed the binding to SOAP, I would expect it to look like -
> > >
> > > <SOAP-ENV:Envelope>
> > >       <SOAP-ENV:Body>
> > >               <AddNumbers>
> > >                       <First>10</First>
> > >                       <Second>20</Second>
> > >               </AddNumbers>
> > >       </SOAP-ENV:Body>
> > > </SOAP-ENV:Envelope>
> > >
> > > If I changed the binding to be Corba it would be in a binary coded
> > format
> > >
> > > (not shown)
> > >

Yes, this should work. What happens behind the scene is that the interceptors in the chain are not harded or fixed, instead interceptors are contributed by bus, endpoint and bindings during the construction time. If you take a look at SoapBindingFactory.java and XMLBindingFactory.java, you will see how different interceptors are added into the chain for different bindings. So just a minor modification to the graph you have drawn below: B,C and F,G might not always be the case, it depends on what interceptors you have in the chain. Take the Dispatch case as an example, because DispatchImpl.java didn't add all these binding interceptors into its outchain (see DispatchImpl.getDispatchOutChain()), there is no JAXB convention involved at all.




> > > My understanding of the interceptor chain is as follows 
> (and maybe I
> > have this wrong, which is where my mis-understanding lies) -
> > >
> > > Client side
> > > ===========
> > > A - I call a function of my port using java objects
> > > B - It gets converted into XML (JAXB)
> > > C - XML goes through binding layer to format the message
> > > D - The transport sends the formatted message
> > >
> > > Server Side
> > > ===========
> > > E - Transport receives the message
> > > F - binding layer decodes message into XML logical message
> > > G - XML is converted into java objects (JAXB)
> > > H - I have my message as a java object
> > >


> > > I want this process to start at C and end after F so that I pass a
> > logical XML message and receive my reply as a logical XML 
> message even
> > though the binding/transport may not have used XML for the 
> communication.
> > I'm doing this at the moment by adding my own JAXB calls 
> before A and after
> > H.
> > >
> > > 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
> > >
> > > -----Original Message-----
> > > From: Freeman Fang [mailto:freeman.fang@iona.com]
> > > Sent: 05 June 2007 11:23
> > > To: cxf-user@incubator.apache.org
> > > Subject: Re: Skipping some layers in the interceptor chain
> > >
> > > Hi Richard,
> > > Comment inline
> > > Shaw, Richard A wrote:
> > >
> > >> If I use the dispatch interface does CXF still pass it 
> through the
> > binding and transport layers ?
> > >>
> > >>
> > > It only skip mashall/unmashall for binding layer, but can 
> not  skip the
> > transport layer, anyway, you need deliver message to remote process
> > >
> > >> The XML in the sample is a soap message which would 
> suggest to me that
> > it isn't using the binding because that would normally 
> convert the XML into
> > SOAP.
> > >>
> > >> My use case requires me to talk to various legacy 
> services using more
> > than SOAP.
> > >>
> > >>
> > >>
> > > SOAP payload is not compulsory here, you can use any 
> payload you like.
> > >
> > > Thanks very much
> > >
> > > Freeman
> > >
> > >
> > >
> > >> 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
> > >>
> > >> -----Original Message-----
> > >> From: Liu, Jervis [mailto:jliu@iona.com]
> > >> Sent: 04 June 2007 03:20
> > >> To: cxf-user@incubator.apache.org
> > >> Subject: RE: Skipping some layers in the interceptor chain
> > >>
> > >> Hi Richard,
> > >>
> > >> Can't you use Dispatch interface? Sth like below shall 
> allow you to
> > >> skip unnecessary JAXB marshalling ( code snippet from CXF
> > >> dispatch_provider sample)
> > >>
> > >>         QName serviceName3 = new QName("
> > http://apache.org/hello_world_soap_http", "SOAPService3");
> > >>         QName portName3 = new
> > >> QName("http://apache.org/hello_world_soap_http", "SoapPort3");
> > >>
> > >>         SOAPService3 service3 = new SOAPService3(wsdlURL,
> > serviceName3);
> > >>         DOMSource domReqPayload = new 
> DOMSource(..................);
> > >>         Dispatch<DOMSource> dispDOMSrcPayload = 
> service3.createDispatch
> > (portName3,
> > >>
> > >> DOMSource.class, Mode.PAYLOAD);
> > >>
> > >>         DOMSource domRespPayload = dispDOMSrcPayload.invoke
> > (domReqPayload);
> > >>
> > >>
> > >> Cheers,
> > >> Jervis
> > >>
> > >>
> > >>
> > >>
> > >>> -----Original Message-----
> > >>> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
> > >>> Sent: 2007?6?1? 23:33
> > >>> To: cxf-user@incubator.apache.org
> > >>> Subject: Skipping some layers in the interceptor chain
> > >>>
> > >>>
> > >>> I have the following requirement and was wondering 
> whether anybody
> > >>> could tell me if it is possible -
> > >>>
> > >>> 1 - I have an XML string which represents the logical 
> message for a
> > >>> request
> > >>> 2 - I want to use this to make a request on an 
> appropriate service
> > >>> 3 - I want to catch the reply at the XML level without 
> creating a
> > >>> java object
> > >>> 4 - transform the reply using a XSL stylesheet to be the logical
> > >>> message of another service
> > >>> 5 - send the logical message to the final service
> > >>>
> > >>> This is for a generic data fetch. It requests data from a SOA
> > >>> component, transforms the data into a set message, 
> which is sent to
> > >>> my datastore component. I don't want to write a new 
> component for
> > >>> every type of data source that I want to fetch data from.
> > >>>
> > >>> I have implemented the above using the original Celtix 
> code, but it
> > >>> has the following inefficiencies -
> > >>>
> > >>> 1 - I load the XML from my config. unmarshal it into an 
> object and
> > >>> then use that to call my service which will marshal as 
> its first step
> > >>> 3 - the response is unmarshalled into a java object so 
> I then marshal
> > >>> it back to an XML stream to pass to the XSLT transformer
> > >>> 5 - I unmarshal the transformed XML into a java object 
> and use that
> > >>> to call my data storage service
> > >>>
> > >>> Thanks
> > >>>
> > >>> 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.
> > >>>
> > >>> Consider the environment. Please don't print this 
> e-mail unless you
> > >>> really need to.
> > >>>
> > >>>
> > >>>
> > >> This message has been scanned for viruses by MailControl - (see
> > >> http://bluepages.wsatkins.co.uk/?6875772)
> > >>
> > >>
> > >>
> > >
> > >
> >
> >
> 
> 
> -- 
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
> 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Skipping some layers in the interceptor chain

Posted by James Mao <ja...@iona.com>.
>
> CXF's wsdl2java tool does not appear to support the Provider/Dispatch 
> style code generation to support document handling.   If i pick up 
> only the "invoke" then I am required to hand code (for instance) the 
> distinction between the 4 operations of the service.
> SWDP's RESTful tooling supports a smart Provider class that will do 
> the needed pattern matching.    What is the equivalent for CXF?

You are right, currently we don't have tools to generate the 
Provider/Dispatch code, tools also not support the RESTful style service,
Do you mind log feature requests on 
https://issues.apache.org/jira/browse/CXF

Thanks,
James

>
>       -- Dan Connelly
>
>
> Dan Diephouse wrote:
>> Ugh please no :-D
>>
>> I'd recommend taking a look at the JAX-WS provider/dispatch 
>> mechanisms. You
>> can send a Source object via the Dispatch (and it will wrap it with a 
>> SOAP
>> body if necessary or handle whatever binding stuff needs to happen). 
>> On the
>> server side you can then receive the XML via a Provider. Once again 
>> you'll
>> get a Source object which should be easy enough to work with.
>>
>> I believe there are some ok samples here:
>>
>> http://java.sun.com/mailers/techtips/enterprise/2006/TechTips_July06.html 
>>
>>
>> - Dan
>>
>> On 6/5/07, Dan Connelly <da...@comcast.net> wrote:
>>>
>>> The most straight-forward (but moderately inefficient) way to process
>>> XML messages within SOAP is to have a service method that merely
>>> exchanges Request-Response XMLs (Strings byte[ ]s),. like so in the
>>> service Interface:
>>>
>>> public interface String getResponse(String myRequestAsXml) ;
>>>
>>> Implement the service in XSL transforms.
>>>
>>> For real-life XML "eFile" messaging service see :
>>> http://www.streamlinedsalestax.org/EFileService-1.0.1.wsdl
>>>
>>>
>>>
>>> Shaw, Richard A wrote:
>>> > I'm not sure if we are talking at cross purposes here. So I'll 
>>> give an
>>> example -
>>> >
>>> > My logical message is -
>>> >
>>> > <AddNumbers>
>>> >       <First>10</First>
>>> >       <Second>20</Second>
>>> > </AddNumbers>
>>> >
>>> > I want to call a Dispatch and pass in the XML as above.
>>> >
>>> > If I set the binding in my wsdl file to be pure XML, I expect to 
>>> see the
>>> XML above passed over the transport.
>>> >
>>> > If I changed the binding to SOAP, I would expect it to look like -
>>> >
>>> > <SOAP-ENV:Envelope>
>>> >       <SOAP-ENV:Body>
>>> >               <AddNumbers>
>>> >                       <First>10</First>
>>> >                       <Second>20</Second>
>>> >               </AddNumbers>
>>> >       </SOAP-ENV:Body>
>>> > </SOAP-ENV:Envelope>
>>> >
>>> > If I changed the binding to be Corba it would be in a binary coded
>>> format
>>> >
>>> > (not shown)
>>> >
>>> > My understanding of the interceptor chain is as follows (and maybe I
>>> have this wrong, which is where my mis-understanding lies) -
>>> >
>>> > Client side
>>> > ===========
>>> > A - I call a function of my port using java objects
>>> > B - It gets converted into XML (JAXB)
>>> > C - XML goes through binding layer to format the message
>>> > D - The transport sends the formatted message
>>> >
>>> > Server Side
>>> > ===========
>>> > E - Transport receives the message
>>> > F - binding layer decodes message into XML logical message
>>> > G - XML is converted into java objects (JAXB)
>>> > H - I have my message as a java object
>>> >
>>> > I want this process to start at C and end after F so that I pass a
>>> logical XML message and receive my reply as a logical XML message even
>>> though the binding/transport may not have used XML for the 
>>> communication.
>>> I'm doing this at the moment by adding my own JAXB calls before A 
>>> and after
>>> H.
>>> >
>>> > 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
>>> >
>>> > -----Original Message-----
>>> > From: Freeman Fang [mailto:freeman.fang@iona.com]
>>> > Sent: 05 June 2007 11:23
>>> > To: cxf-user@incubator.apache.org
>>> > Subject: Re: Skipping some layers in the interceptor chain
>>> >
>>> > Hi Richard,
>>> > Comment inline
>>> > Shaw, Richard A wrote:
>>> >
>>> >> If I use the dispatch interface does CXF still pass it through the
>>> binding and transport layers ?
>>> >>
>>> >>
>>> > It only skip mashall/unmashall for binding layer, but can not  
>>> skip the
>>> transport layer, anyway, you need deliver message to remote process
>>> >
>>> >> The XML in the sample is a soap message which would suggest to me 
>>> that
>>> it isn't using the binding because that would normally convert the 
>>> XML into
>>> SOAP.
>>> >>
>>> >> My use case requires me to talk to various legacy services using 
>>> more
>>> than SOAP.
>>> >>
>>> >>
>>> >>
>>> > SOAP payload is not compulsory here, you can use any payload you 
>>> like.
>>> >
>>> > Thanks very much
>>> >
>>> > Freeman
>>> >
>>> >
>>> >
>>> >> 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
>>> >>
>>> >> -----Original Message-----
>>> >> From: Liu, Jervis [mailto:jliu@iona.com]
>>> >> Sent: 04 June 2007 03:20
>>> >> To: cxf-user@incubator.apache.org
>>> >> Subject: RE: Skipping some layers in the interceptor chain
>>> >>
>>> >> Hi Richard,
>>> >>
>>> >> Can't you use Dispatch interface? Sth like below shall allow you to
>>> >> skip unnecessary JAXB marshalling ( code snippet from CXF
>>> >> dispatch_provider sample)
>>> >>
>>> >>         QName serviceName3 = new QName("
>>> http://apache.org/hello_world_soap_http", "SOAPService3");
>>> >>         QName portName3 = new
>>> >> QName("http://apache.org/hello_world_soap_http", "SoapPort3");
>>> >>
>>> >>         SOAPService3 service3 = new SOAPService3(wsdlURL,
>>> serviceName3);
>>> >>         DOMSource domReqPayload = new DOMSource(..................);
>>> >>         Dispatch<DOMSource> dispDOMSrcPayload = 
>>> service3.createDispatch
>>> (portName3,
>>> >>
>>> >> DOMSource.class, Mode.PAYLOAD);
>>> >>
>>> >>         DOMSource domRespPayload = dispDOMSrcPayload.invoke
>>> (domReqPayload);
>>> >>
>>> >>
>>> >> Cheers,
>>> >> Jervis
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>> -----Original Message-----
>>> >>> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
>>> >>> Sent: 2007?6?1? 23:33
>>> >>> To: cxf-user@incubator.apache.org
>>> >>> Subject: Skipping some layers in the interceptor chain
>>> >>>
>>> >>>
>>> >>> I have the following requirement and was wondering whether anybody
>>> >>> could tell me if it is possible -
>>> >>>
>>> >>> 1 - I have an XML string which represents the logical message for a
>>> >>> request
>>> >>> 2 - I want to use this to make a request on an appropriate service
>>> >>> 3 - I want to catch the reply at the XML level without creating a
>>> >>> java object
>>> >>> 4 - transform the reply using a XSL stylesheet to be the logical
>>> >>> message of another service
>>> >>> 5 - send the logical message to the final service
>>> >>>
>>> >>> This is for a generic data fetch. It requests data from a SOA
>>> >>> component, transforms the data into a set message, which is sent to
>>> >>> my datastore component. I don't want to write a new component for
>>> >>> every type of data source that I want to fetch data from.
>>> >>>
>>> >>> I have implemented the above using the original Celtix code, but it
>>> >>> has the following inefficiencies -
>>> >>>
>>> >>> 1 - I load the XML from my config. unmarshal it into an object and
>>> >>> then use that to call my service which will marshal as its first 
>>> step
>>> >>> 3 - the response is unmarshalled into a java object so I then 
>>> marshal
>>> >>> it back to an XML stream to pass to the XSLT transformer
>>> >>> 5 - I unmarshal the transformed XML into a java object and use that
>>> >>> to call my data storage service
>>> >>>
>>> >>> Thanks
>>> >>>
>>> >>> 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.
>>> >>>
>>> >>> Consider the environment. Please don't print this e-mail unless you
>>> >>> really need to.
>>> >>>
>>> >>>
>>> >>>
>>> >> This message has been scanned for viruses by MailControl - (see
>>> >> http://bluepages.wsatkins.co.uk/?6875772)
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>>
>>>
>>
>>
>

Re: Skipping some layers in the interceptor chain

Posted by Dan Connelly <da...@comcast.net>.
Dan:

Axis 1.x is simpler, though less efficient, in the case of the service 
definition I gave (EFileService-1.0.1.wsdl) where the implementation 
logic is essentially xsl (document handling, as the TechTip puts it).

Note that the Send operation of this service is actually not completely 
ugh-ish.   The XML is not forced into <xsd:string/> (as I had suggested 
for illustration).   It is forced only into <xsd:any/>, a lesser ugh.

However, while Axis 1.x has a useful binding for <xsd:any/>, CXF does 
not.   (Appears not to.)

In Axis 1.x  a sequence of <xsd:any/> is bound as an array of 
ElementMessage objects, essentially a sequence of arbitrary DOM nodes.

In CXF, getAny() returns only a generic Object, which is much less 
helpful as input into an XSL Transformer.

CXF's wsdl2java tool does not appear to support the Provider/Dispatch 
style code generation to support document handling.   If i pick up only 
the "invoke" then I am required to hand code (for instance) the 
distinction between the 4 operations of the service. 

SWDP's RESTful tooling supports a smart Provider class that will do the 
needed pattern matching.    What is the equivalent for CXF?

       -- Dan Connelly


Dan Diephouse wrote:
> Ugh please no :-D
>
> I'd recommend taking a look at the JAX-WS provider/dispatch 
> mechanisms. You
> can send a Source object via the Dispatch (and it will wrap it with a 
> SOAP
> body if necessary or handle whatever binding stuff needs to happen). 
> On the
> server side you can then receive the XML via a Provider. Once again 
> you'll
> get a Source object which should be easy enough to work with.
>
> I believe there are some ok samples here:
>
> http://java.sun.com/mailers/techtips/enterprise/2006/TechTips_July06.html
>
> - Dan
>
> On 6/5/07, Dan Connelly <da...@comcast.net> wrote:
>>
>> The most straight-forward (but moderately inefficient) way to process
>> XML messages within SOAP is to have a service method that merely
>> exchanges Request-Response XMLs (Strings byte[ ]s),. like so in the
>> service Interface:
>>
>> public interface String getResponse(String myRequestAsXml) ;
>>
>> Implement the service in XSL transforms.
>>
>> For real-life XML "eFile" messaging service see :
>> http://www.streamlinedsalestax.org/EFileService-1.0.1.wsdl
>>
>>
>>
>> Shaw, Richard A wrote:
>> > I'm not sure if we are talking at cross purposes here. So I'll give an
>> example -
>> >
>> > My logical message is -
>> >
>> > <AddNumbers>
>> >       <First>10</First>
>> >       <Second>20</Second>
>> > </AddNumbers>
>> >
>> > I want to call a Dispatch and pass in the XML as above.
>> >
>> > If I set the binding in my wsdl file to be pure XML, I expect to 
>> see the
>> XML above passed over the transport.
>> >
>> > If I changed the binding to SOAP, I would expect it to look like -
>> >
>> > <SOAP-ENV:Envelope>
>> >       <SOAP-ENV:Body>
>> >               <AddNumbers>
>> >                       <First>10</First>
>> >                       <Second>20</Second>
>> >               </AddNumbers>
>> >       </SOAP-ENV:Body>
>> > </SOAP-ENV:Envelope>
>> >
>> > If I changed the binding to be Corba it would be in a binary coded
>> format
>> >
>> > (not shown)
>> >
>> > My understanding of the interceptor chain is as follows (and maybe I
>> have this wrong, which is where my mis-understanding lies) -
>> >
>> > Client side
>> > ===========
>> > A - I call a function of my port using java objects
>> > B - It gets converted into XML (JAXB)
>> > C - XML goes through binding layer to format the message
>> > D - The transport sends the formatted message
>> >
>> > Server Side
>> > ===========
>> > E - Transport receives the message
>> > F - binding layer decodes message into XML logical message
>> > G - XML is converted into java objects (JAXB)
>> > H - I have my message as a java object
>> >
>> > I want this process to start at C and end after F so that I pass a
>> logical XML message and receive my reply as a logical XML message even
>> though the binding/transport may not have used XML for the 
>> communication.
>> I'm doing this at the moment by adding my own JAXB calls before A and 
>> after
>> H.
>> >
>> > 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
>> >
>> > -----Original Message-----
>> > From: Freeman Fang [mailto:freeman.fang@iona.com]
>> > Sent: 05 June 2007 11:23
>> > To: cxf-user@incubator.apache.org
>> > Subject: Re: Skipping some layers in the interceptor chain
>> >
>> > Hi Richard,
>> > Comment inline
>> > Shaw, Richard A wrote:
>> >
>> >> If I use the dispatch interface does CXF still pass it through the
>> binding and transport layers ?
>> >>
>> >>
>> > It only skip mashall/unmashall for binding layer, but can not  skip 
>> the
>> transport layer, anyway, you need deliver message to remote process
>> >
>> >> The XML in the sample is a soap message which would suggest to me 
>> that
>> it isn't using the binding because that would normally convert the 
>> XML into
>> SOAP.
>> >>
>> >> My use case requires me to talk to various legacy services using more
>> than SOAP.
>> >>
>> >>
>> >>
>> > SOAP payload is not compulsory here, you can use any payload you like.
>> >
>> > Thanks very much
>> >
>> > Freeman
>> >
>> >
>> >
>> >> 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
>> >>
>> >> -----Original Message-----
>> >> From: Liu, Jervis [mailto:jliu@iona.com]
>> >> Sent: 04 June 2007 03:20
>> >> To: cxf-user@incubator.apache.org
>> >> Subject: RE: Skipping some layers in the interceptor chain
>> >>
>> >> Hi Richard,
>> >>
>> >> Can't you use Dispatch interface? Sth like below shall allow you to
>> >> skip unnecessary JAXB marshalling ( code snippet from CXF
>> >> dispatch_provider sample)
>> >>
>> >>         QName serviceName3 = new QName("
>> http://apache.org/hello_world_soap_http", "SOAPService3");
>> >>         QName portName3 = new
>> >> QName("http://apache.org/hello_world_soap_http", "SoapPort3");
>> >>
>> >>         SOAPService3 service3 = new SOAPService3(wsdlURL,
>> serviceName3);
>> >>         DOMSource domReqPayload = new DOMSource(..................);
>> >>         Dispatch<DOMSource> dispDOMSrcPayload = 
>> service3.createDispatch
>> (portName3,
>> >>
>> >> DOMSource.class, Mode.PAYLOAD);
>> >>
>> >>         DOMSource domRespPayload = dispDOMSrcPayload.invoke
>> (domReqPayload);
>> >>
>> >>
>> >> Cheers,
>> >> Jervis
>> >>
>> >>
>> >>
>> >>
>> >>> -----Original Message-----
>> >>> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
>> >>> Sent: 2007?6?1? 23:33
>> >>> To: cxf-user@incubator.apache.org
>> >>> Subject: Skipping some layers in the interceptor chain
>> >>>
>> >>>
>> >>> I have the following requirement and was wondering whether anybody
>> >>> could tell me if it is possible -
>> >>>
>> >>> 1 - I have an XML string which represents the logical message for a
>> >>> request
>> >>> 2 - I want to use this to make a request on an appropriate service
>> >>> 3 - I want to catch the reply at the XML level without creating a
>> >>> java object
>> >>> 4 - transform the reply using a XSL stylesheet to be the logical
>> >>> message of another service
>> >>> 5 - send the logical message to the final service
>> >>>
>> >>> This is for a generic data fetch. It requests data from a SOA
>> >>> component, transforms the data into a set message, which is sent to
>> >>> my datastore component. I don't want to write a new component for
>> >>> every type of data source that I want to fetch data from.
>> >>>
>> >>> I have implemented the above using the original Celtix code, but it
>> >>> has the following inefficiencies -
>> >>>
>> >>> 1 - I load the XML from my config. unmarshal it into an object and
>> >>> then use that to call my service which will marshal as its first 
>> step
>> >>> 3 - the response is unmarshalled into a java object so I then 
>> marshal
>> >>> it back to an XML stream to pass to the XSLT transformer
>> >>> 5 - I unmarshal the transformed XML into a java object and use that
>> >>> to call my data storage service
>> >>>
>> >>> Thanks
>> >>>
>> >>> 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.
>> >>>
>> >>> Consider the environment. Please don't print this e-mail unless you
>> >>> really need to.
>> >>>
>> >>>
>> >>>
>> >> This message has been scanned for viruses by MailControl - (see
>> >> http://bluepages.wsatkins.co.uk/?6875772)
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>
>


Re: Skipping some layers in the interceptor chain

Posted by Dan Diephouse <da...@envoisolutions.com>.
Ugh please no :-D

I'd recommend taking a look at the JAX-WS provider/dispatch mechanisms. You
can send a Source object via the Dispatch (and it will wrap it with a SOAP
body if necessary or handle whatever binding stuff needs to happen). On the
server side you can then receive the XML via a Provider. Once again you'll
get a Source object which should be easy enough to work with.

I believe there are some ok samples here:

http://java.sun.com/mailers/techtips/enterprise/2006/TechTips_July06.html

- Dan

On 6/5/07, Dan Connelly <da...@comcast.net> wrote:
>
> The most straight-forward (but moderately inefficient) way to process
> XML messages within SOAP is to have a service method that merely
> exchanges Request-Response XMLs (Strings byte[ ]s),. like so in the
> service Interface:
>
> public interface String getResponse(String myRequestAsXml) ;
>
> Implement the service in XSL transforms.
>
> For real-life XML "eFile" messaging service see :
> http://www.streamlinedsalestax.org/EFileService-1.0.1.wsdl
>
>
>
> Shaw, Richard A wrote:
> > I'm not sure if we are talking at cross purposes here. So I'll give an
> example -
> >
> > My logical message is -
> >
> > <AddNumbers>
> >       <First>10</First>
> >       <Second>20</Second>
> > </AddNumbers>
> >
> > I want to call a Dispatch and pass in the XML as above.
> >
> > If I set the binding in my wsdl file to be pure XML, I expect to see the
> XML above passed over the transport.
> >
> > If I changed the binding to SOAP, I would expect it to look like -
> >
> > <SOAP-ENV:Envelope>
> >       <SOAP-ENV:Body>
> >               <AddNumbers>
> >                       <First>10</First>
> >                       <Second>20</Second>
> >               </AddNumbers>
> >       </SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> >
> > If I changed the binding to be Corba it would be in a binary coded
> format
> >
> > (not shown)
> >
> > My understanding of the interceptor chain is as follows (and maybe I
> have this wrong, which is where my mis-understanding lies) -
> >
> > Client side
> > ===========
> > A - I call a function of my port using java objects
> > B - It gets converted into XML (JAXB)
> > C - XML goes through binding layer to format the message
> > D - The transport sends the formatted message
> >
> > Server Side
> > ===========
> > E - Transport receives the message
> > F - binding layer decodes message into XML logical message
> > G - XML is converted into java objects (JAXB)
> > H - I have my message as a java object
> >
> > I want this process to start at C and end after F so that I pass a
> logical XML message and receive my reply as a logical XML message even
> though the binding/transport may not have used XML for the communication.
> I'm doing this at the moment by adding my own JAXB calls before A and after
> H.
> >
> > 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
> >
> > -----Original Message-----
> > From: Freeman Fang [mailto:freeman.fang@iona.com]
> > Sent: 05 June 2007 11:23
> > To: cxf-user@incubator.apache.org
> > Subject: Re: Skipping some layers in the interceptor chain
> >
> > Hi Richard,
> > Comment inline
> > Shaw, Richard A wrote:
> >
> >> If I use the dispatch interface does CXF still pass it through the
> binding and transport layers ?
> >>
> >>
> > It only skip mashall/unmashall for binding layer, but can not  skip the
> transport layer, anyway, you need deliver message to remote process
> >
> >> The XML in the sample is a soap message which would suggest to me that
> it isn't using the binding because that would normally convert the XML into
> SOAP.
> >>
> >> My use case requires me to talk to various legacy services using more
> than SOAP.
> >>
> >>
> >>
> > SOAP payload is not compulsory here, you can use any payload you like.
> >
> > Thanks very much
> >
> > Freeman
> >
> >
> >
> >> 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
> >>
> >> -----Original Message-----
> >> From: Liu, Jervis [mailto:jliu@iona.com]
> >> Sent: 04 June 2007 03:20
> >> To: cxf-user@incubator.apache.org
> >> Subject: RE: Skipping some layers in the interceptor chain
> >>
> >> Hi Richard,
> >>
> >> Can't you use Dispatch interface? Sth like below shall allow you to
> >> skip unnecessary JAXB marshalling ( code snippet from CXF
> >> dispatch_provider sample)
> >>
> >>         QName serviceName3 = new QName("
> http://apache.org/hello_world_soap_http", "SOAPService3");
> >>         QName portName3 = new
> >> QName("http://apache.org/hello_world_soap_http", "SoapPort3");
> >>
> >>         SOAPService3 service3 = new SOAPService3(wsdlURL,
> serviceName3);
> >>         DOMSource domReqPayload = new DOMSource(..................);
> >>         Dispatch<DOMSource> dispDOMSrcPayload = service3.createDispatch
> (portName3,
> >>
> >> DOMSource.class, Mode.PAYLOAD);
> >>
> >>         DOMSource domRespPayload = dispDOMSrcPayload.invoke
> (domReqPayload);
> >>
> >>
> >> Cheers,
> >> Jervis
> >>
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
> >>> Sent: 2007?6?1? 23:33
> >>> To: cxf-user@incubator.apache.org
> >>> Subject: Skipping some layers in the interceptor chain
> >>>
> >>>
> >>> I have the following requirement and was wondering whether anybody
> >>> could tell me if it is possible -
> >>>
> >>> 1 - I have an XML string which represents the logical message for a
> >>> request
> >>> 2 - I want to use this to make a request on an appropriate service
> >>> 3 - I want to catch the reply at the XML level without creating a
> >>> java object
> >>> 4 - transform the reply using a XSL stylesheet to be the logical
> >>> message of another service
> >>> 5 - send the logical message to the final service
> >>>
> >>> This is for a generic data fetch. It requests data from a SOA
> >>> component, transforms the data into a set message, which is sent to
> >>> my datastore component. I don't want to write a new component for
> >>> every type of data source that I want to fetch data from.
> >>>
> >>> I have implemented the above using the original Celtix code, but it
> >>> has the following inefficiencies -
> >>>
> >>> 1 - I load the XML from my config. unmarshal it into an object and
> >>> then use that to call my service which will marshal as its first step
> >>> 3 - the response is unmarshalled into a java object so I then marshal
> >>> it back to an XML stream to pass to the XSLT transformer
> >>> 5 - I unmarshal the transformed XML into a java object and use that
> >>> to call my data storage service
> >>>
> >>> Thanks
> >>>
> >>> 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.
> >>>
> >>> Consider the environment. Please don't print this e-mail unless you
> >>> really need to.
> >>>
> >>>
> >>>
> >> This message has been scanned for viruses by MailControl - (see
> >> http://bluepages.wsatkins.co.uk/?6875772)
> >>
> >>
> >>
> >
> >
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: Skipping some layers in the interceptor chain

Posted by Dan Connelly <da...@comcast.net>.
The most straight-forward (but moderately inefficient) way to process 
XML messages within SOAP is to have a service method that merely 
exchanges Request-Response XMLs (Strings byte[ ]s),. like so in the 
service Interface:

public interface String getResponse(String myRequestAsXml) ;

Implement the service in XSL transforms.

For real-life XML "eFile" messaging service see :   
http://www.streamlinedsalestax.org/EFileService-1.0.1.wsdl



Shaw, Richard A wrote:
> I'm not sure if we are talking at cross purposes here. So I'll give an example -
>
> My logical message is -
>
> <AddNumbers>
> 	<First>10</First>
> 	<Second>20</Second>
> </AddNumbers>
>
> I want to call a Dispatch and pass in the XML as above.
>
> If I set the binding in my wsdl file to be pure XML, I expect to see the XML above passed over the transport.
>
> If I changed the binding to SOAP, I would expect it to look like -
>
> <SOAP-ENV:Envelope>
> 	<SOAP-ENV:Body> 
> 		<AddNumbers>
> 			<First>10</First>
> 			<Second>20</Second>
> 		</AddNumbers>
> 	</SOAP-ENV:Body> 
> </SOAP-ENV:Envelope>
>
> If I changed the binding to be Corba it would be in a binary coded format 
>
> (not shown)
>
> My understanding of the interceptor chain is as follows (and maybe I have this wrong, which is where my mis-understanding lies) -
>
> Client side
> ===========
> A - I call a function of my port using java objects
> B - It gets converted into XML (JAXB)
> C - XML goes through binding layer to format the message
> D - The transport sends the formatted message
>
> Server Side
> ===========
> E - Transport receives the message
> F - binding layer decodes message into XML logical message
> G - XML is converted into java objects (JAXB)
> H - I have my message as a java object
>
> I want this process to start at C and end after F so that I pass a logical XML message and receive my reply as a logical XML message even though the binding/transport may not have used XML for the communication. I'm doing this at the moment by adding my own JAXB calls before A and after H.
>
> 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
>
> -----Original Message-----
> From: Freeman Fang [mailto:freeman.fang@iona.com] 
> Sent: 05 June 2007 11:23
> To: cxf-user@incubator.apache.org
> Subject: Re: Skipping some layers in the interceptor chain
>
> Hi Richard,
> Comment inline
> Shaw, Richard A wrote:
>   
>> If I use the dispatch interface does CXF still pass it through the binding and transport layers ?
>>   
>>     
> It only skip mashall/unmashall for binding layer, but can not  skip the transport layer, anyway, you need deliver message to remote process
>   
>> The XML in the sample is a soap message which would suggest to me that it isn't using the binding because that would normally convert the XML into SOAP.
>>
>> My use case requires me to talk to various legacy services using more than SOAP. 
>>
>>   
>>     
> SOAP payload is not compulsory here, you can use any payload you like.
>
> Thanks very much
>
> Freeman
>
>
>   
>> 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
>>
>> -----Original Message-----
>> From: Liu, Jervis [mailto:jliu@iona.com]
>> Sent: 04 June 2007 03:20
>> To: cxf-user@incubator.apache.org
>> Subject: RE: Skipping some layers in the interceptor chain
>>
>> Hi Richard,
>>
>> Can't you use Dispatch interface? Sth like below shall allow you to 
>> skip unnecessary JAXB marshalling ( code snippet from CXF 
>> dispatch_provider sample)
>>
>>         QName serviceName3 = new QName("http://apache.org/hello_world_soap_http", "SOAPService3");
>>         QName portName3 = new 
>> QName("http://apache.org/hello_world_soap_http", "SoapPort3");
>>         
>>         SOAPService3 service3 = new SOAPService3(wsdlURL, serviceName3);         
>>         DOMSource domReqPayload = new DOMSource(..................);           
>>         Dispatch<DOMSource> dispDOMSrcPayload = service3.createDispatch(portName3, 
>>                                                                         
>> DOMSource.class, Mode.PAYLOAD);
>>
>>         DOMSource domRespPayload = dispDOMSrcPayload.invoke(domReqPayload);       
>>
>>
>> Cheers,
>> Jervis
>>
>>
>>   
>>     
>>> -----Original Message-----
>>> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
>>> Sent: 2007?6?1? 23:33
>>> To: cxf-user@incubator.apache.org
>>> Subject: Skipping some layers in the interceptor chain
>>>
>>>
>>> I have the following requirement and was wondering whether anybody 
>>> could tell me if it is possible -
>>>
>>> 1 - I have an XML string which represents the logical message for a 
>>> request
>>> 2 - I want to use this to make a request on an appropriate service
>>> 3 - I want to catch the reply at the XML level without creating a 
>>> java object
>>> 4 - transform the reply using a XSL stylesheet to be the logical 
>>> message of another service
>>> 5 - send the logical message to the final service
>>>
>>> This is for a generic data fetch. It requests data from a SOA 
>>> component, transforms the data into a set message, which is sent to 
>>> my datastore component. I don't want to write a new component for 
>>> every type of data source that I want to fetch data from.
>>>
>>> I have implemented the above using the original Celtix code, but it 
>>> has the following inefficiencies -
>>>
>>> 1 - I load the XML from my config. unmarshal it into an object and 
>>> then use that to call my service which will marshal as its first step
>>> 3 - the response is unmarshalled into a java object so I then marshal 
>>> it back to an XML stream to pass to the XSLT transformer
>>> 5 - I unmarshal the transformed XML into a java object and use that 
>>> to call my data storage service
>>>
>>> Thanks
>>>
>>> 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.
>>>
>>> Consider the environment. Please don't print this e-mail unless you 
>>> really need to.
>>>
>>>     
>>>       
>> This message has been scanned for viruses by MailControl - (see 
>> http://bluepages.wsatkins.co.uk/?6875772)
>>
>>   
>>     
>
>   


RE: Skipping some layers in the interceptor chain

Posted by "Shaw, Richard A" <ri...@atkinsglobal.com>.
I'm not sure if we are talking at cross purposes here. So I'll give an example -

My logical message is -

<AddNumbers>
	<First>10</First>
	<Second>20</Second>
</AddNumbers>

I want to call a Dispatch and pass in the XML as above.

If I set the binding in my wsdl file to be pure XML, I expect to see the XML above passed over the transport.

If I changed the binding to SOAP, I would expect it to look like -

<SOAP-ENV:Envelope>
	<SOAP-ENV:Body> 
		<AddNumbers>
			<First>10</First>
			<Second>20</Second>
		</AddNumbers>
	</SOAP-ENV:Body> 
</SOAP-ENV:Envelope>

If I changed the binding to be Corba it would be in a binary coded format 

(not shown)

My understanding of the interceptor chain is as follows (and maybe I have this wrong, which is where my mis-understanding lies) -

Client side
===========
A - I call a function of my port using java objects
B - It gets converted into XML (JAXB)
C - XML goes through binding layer to format the message
D - The transport sends the formatted message

Server Side
===========
E - Transport receives the message
F - binding layer decodes message into XML logical message
G - XML is converted into java objects (JAXB)
H - I have my message as a java object

I want this process to start at C and end after F so that I pass a logical XML message and receive my reply as a logical XML message even though the binding/transport may not have used XML for the communication. I'm doing this at the moment by adding my own JAXB calls before A and after H.

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

-----Original Message-----
From: Freeman Fang [mailto:freeman.fang@iona.com] 
Sent: 05 June 2007 11:23
To: cxf-user@incubator.apache.org
Subject: Re: Skipping some layers in the interceptor chain

Hi Richard,
Comment inline
Shaw, Richard A wrote:
> If I use the dispatch interface does CXF still pass it through the binding and transport layers ?
>   
It only skip mashall/unmashall for binding layer, but can not  skip the transport layer, anyway, you need deliver message to remote process
> The XML in the sample is a soap message which would suggest to me that it isn't using the binding because that would normally convert the XML into SOAP.
>
> My use case requires me to talk to various legacy services using more than SOAP. 
>
>   
SOAP payload is not compulsory here, you can use any payload you like.

Thanks very much

Freeman


> 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
>
> -----Original Message-----
> From: Liu, Jervis [mailto:jliu@iona.com]
> Sent: 04 June 2007 03:20
> To: cxf-user@incubator.apache.org
> Subject: RE: Skipping some layers in the interceptor chain
>
> Hi Richard,
>
> Can't you use Dispatch interface? Sth like below shall allow you to 
> skip unnecessary JAXB marshalling ( code snippet from CXF 
> dispatch_provider sample)
>
>         QName serviceName3 = new QName("http://apache.org/hello_world_soap_http", "SOAPService3");
>         QName portName3 = new 
> QName("http://apache.org/hello_world_soap_http", "SoapPort3");
>         
>         SOAPService3 service3 = new SOAPService3(wsdlURL, serviceName3);         
>         DOMSource domReqPayload = new DOMSource(..................);           
>         Dispatch<DOMSource> dispDOMSrcPayload = service3.createDispatch(portName3, 
>                                                                         
> DOMSource.class, Mode.PAYLOAD);
>
>         DOMSource domRespPayload = dispDOMSrcPayload.invoke(domReqPayload);       
>
>
> Cheers,
> Jervis
>
>
>   
>> -----Original Message-----
>> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
>> Sent: 2007?6?1? 23:33
>> To: cxf-user@incubator.apache.org
>> Subject: Skipping some layers in the interceptor chain
>>
>>
>> I have the following requirement and was wondering whether anybody 
>> could tell me if it is possible -
>>
>> 1 - I have an XML string which represents the logical message for a 
>> request
>> 2 - I want to use this to make a request on an appropriate service
>> 3 - I want to catch the reply at the XML level without creating a 
>> java object
>> 4 - transform the reply using a XSL stylesheet to be the logical 
>> message of another service
>> 5 - send the logical message to the final service
>>
>> This is for a generic data fetch. It requests data from a SOA 
>> component, transforms the data into a set message, which is sent to 
>> my datastore component. I don't want to write a new component for 
>> every type of data source that I want to fetch data from.
>>
>> I have implemented the above using the original Celtix code, but it 
>> has the following inefficiencies -
>>
>> 1 - I load the XML from my config. unmarshal it into an object and 
>> then use that to call my service which will marshal as its first step
>> 3 - the response is unmarshalled into a java object so I then marshal 
>> it back to an XML stream to pass to the XSLT transformer
>> 5 - I unmarshal the transformed XML into a java object and use that 
>> to call my data storage service
>>
>> Thanks
>>
>> 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.
>>
>> Consider the environment. Please don't print this e-mail unless you 
>> really need to.
>>
>>     
>
>
> This message has been scanned for viruses by MailControl - (see 
> http://bluepages.wsatkins.co.uk/?6875772)
>
>   

Re: Skipping some layers in the interceptor chain

Posted by Freeman Fang <fr...@iona.com>.
Hi Richard,
Comment inline
Shaw, Richard A wrote:
> If I use the dispatch interface does CXF still pass it through the binding and transport layers ?
>   
It only skip mashall/unmashall for binding layer, but can not  skip the 
transport layer, anyway, you need deliver message to remote process
> The XML in the sample is a soap message which would suggest to me that it isn't using the binding because that would normally convert the XML into SOAP.
>
> My use case requires me to talk to various legacy services using more than SOAP. 
>
>   
SOAP payload is not compulsory here, you can use any payload you like.

Thanks very much

Freeman


> 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
>
> -----Original Message-----
> From: Liu, Jervis [mailto:jliu@iona.com] 
> Sent: 04 June 2007 03:20
> To: cxf-user@incubator.apache.org
> Subject: RE: Skipping some layers in the interceptor chain
>
> Hi Richard, 
>
> Can't you use Dispatch interface? Sth like below shall allow you to skip unnecessary JAXB marshalling ( code snippet from CXF dispatch_provider sample)
>
>         QName serviceName3 = new QName("http://apache.org/hello_world_soap_http", "SOAPService3");
>         QName portName3 = new QName("http://apache.org/hello_world_soap_http", "SoapPort3"); 
>         
>         SOAPService3 service3 = new SOAPService3(wsdlURL, serviceName3);         
>         DOMSource domReqPayload = new DOMSource(..................);           
>         Dispatch<DOMSource> dispDOMSrcPayload = service3.createDispatch(portName3, 
>                                                                         DOMSource.class, Mode.PAYLOAD);
>
>         DOMSource domRespPayload = dispDOMSrcPayload.invoke(domReqPayload);       
>
>
> Cheers,
> Jervis
>
>
>   
>> -----Original Message-----
>> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
>> Sent: 2007?6?1? 23:33
>> To: cxf-user@incubator.apache.org
>> Subject: Skipping some layers in the interceptor chain
>>
>>
>> I have the following requirement and was wondering whether anybody 
>> could tell me if it is possible -
>>
>> 1 - I have an XML string which represents the logical message for a 
>> request
>> 2 - I want to use this to make a request on an appropriate service
>> 3 - I want to catch the reply at the XML level without creating a java 
>> object
>> 4 - transform the reply using a XSL stylesheet to be the logical 
>> message of another service
>> 5 - send the logical message to the final service
>>
>> This is for a generic data fetch. It requests data from a SOA 
>> component, transforms the data into a set message, which is sent to my 
>> datastore component. I don't want to write a new component for every 
>> type of data source that I want to fetch data from.
>>
>> I have implemented the above using the original Celtix code, but it 
>> has the following inefficiencies -
>>
>> 1 - I load the XML from my config. unmarshal it into an object and 
>> then use that to call my service which will marshal as its first step
>> 3 - the response is unmarshalled into a java object so I then marshal 
>> it back to an XML stream to pass to the XSLT transformer
>> 5 - I unmarshal the transformed XML into a java object and use that to 
>> call my data storage service
>>
>> Thanks
>>
>> 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.
>>
>> Consider the environment. Please don't print this e-mail unless you 
>> really need to.
>>
>>     
>
>
> This message has been scanned for viruses by MailControl - (see http://bluepages.wsatkins.co.uk/?6875772)
>
>   

RE: Skipping some layers in the interceptor chain

Posted by "Shaw, Richard A" <ri...@atkinsglobal.com>.
If I use the dispatch interface does CXF still pass it through the binding and transport layers ?

The XML in the sample is a soap message which would suggest to me that it isn't using the binding because that would normally convert the XML into SOAP.

My use case requires me to talk to various legacy services using more than SOAP. 


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

-----Original Message-----
From: Liu, Jervis [mailto:jliu@iona.com] 
Sent: 04 June 2007 03:20
To: cxf-user@incubator.apache.org
Subject: RE: Skipping some layers in the interceptor chain

Hi Richard, 

Can't you use Dispatch interface? Sth like below shall allow you to skip unnecessary JAXB marshalling ( code snippet from CXF dispatch_provider sample)

        QName serviceName3 = new QName("http://apache.org/hello_world_soap_http", "SOAPService3");
        QName portName3 = new QName("http://apache.org/hello_world_soap_http", "SoapPort3"); 
        
        SOAPService3 service3 = new SOAPService3(wsdlURL, serviceName3);         
        DOMSource domReqPayload = new DOMSource(..................);           
        Dispatch<DOMSource> dispDOMSrcPayload = service3.createDispatch(portName3, 
                                                                        DOMSource.class, Mode.PAYLOAD);

        DOMSource domRespPayload = dispDOMSrcPayload.invoke(domReqPayload);       


Cheers,
Jervis


> -----Original Message-----
> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
> Sent: 2007?6?1? 23:33
> To: cxf-user@incubator.apache.org
> Subject: Skipping some layers in the interceptor chain
> 
> 
> I have the following requirement and was wondering whether anybody 
> could tell me if it is possible -
> 
> 1 - I have an XML string which represents the logical message for a 
> request
> 2 - I want to use this to make a request on an appropriate service
> 3 - I want to catch the reply at the XML level without creating a java 
> object
> 4 - transform the reply using a XSL stylesheet to be the logical 
> message of another service
> 5 - send the logical message to the final service
> 
> This is for a generic data fetch. It requests data from a SOA 
> component, transforms the data into a set message, which is sent to my 
> datastore component. I don't want to write a new component for every 
> type of data source that I want to fetch data from.
> 
> I have implemented the above using the original Celtix code, but it 
> has the following inefficiencies -
> 
> 1 - I load the XML from my config. unmarshal it into an object and 
> then use that to call my service which will marshal as its first step
> 3 - the response is unmarshalled into a java object so I then marshal 
> it back to an XML stream to pass to the XSLT transformer
> 5 - I unmarshal the transformed XML into a java object and use that to 
> call my data storage service
> 
> Thanks
> 
> 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.
> 
> Consider the environment. Please don't print this e-mail unless you 
> really need to.
> 


This message has been scanned for viruses by MailControl - (see http://bluepages.wsatkins.co.uk/?6875772)

Re: Usage of JaxWsServerFactoryBean

Posted by Dan Diephouse <da...@envoisolutions.com>.
Hi Jervis,

Apologies for the lag, due to random Gmail weirdness, this ended up not
being in my main CXF folder...

On 6/4/07, Liu, Jervis <jl...@iona.com> wrote:
>
> Hi,
>
> Recently I've seen some confusions in our user group around the usage of
> JaxWsServerFactoryBean, and to be honest, it confuses me sometimes as well.
> To better document this part, I have gathered couple of  questions, now I m
> inviting you to give out your answers and comments. Of course I know we
> programmers all hate writing documents, so I also provided some of my
> answers, but with no guarantee to be correct. Please review my answers and
> feel free to correct. Once this done, I ll put them into CXF documentation.


:-)

1. Q: When shall I use standard JAX-WS API (e.g.,
> javax.xml.ws.Endpoint.publish()) to publish a service and when shall I use
> JaxWsServerFactoryBean?
>    A: Recently I've seen we are giving out a lot of code snippet to users
> that using JaxWsServerFactoryBean. Are we encouraging users to use  this
> JaxWsServerFactoryBean API, or we should encourage them to stick to standard
> JAX-WS APIs as much as possible? The next question followed up naturally is
> when I have to use JaxWsServerFactoryBean? My understanding is you use
> JaxWsServerFactoryBean only when you have to  programmatically set some CXF
> specific properties on JaxWsServerFactoryBean, e.g., set the BeanInvoker


+1 - I think we should promote Endpoint as an entry point for JAX-WS unless
there's some stuff a user needs to control.

2. Q: Is JaxWsServerFactoryBean exactly equivalent to
> javax.xml.ws.Endpoint.publish()?
>    A: Unfortunately, this is not the case. For example, handler chain and
> context injection is not done in JaxWsServerFactoryBean. There is a relevant
> JIRA issues about this (http://issues.apache.org/jira/browse/CXF-558).  I
> think we should refactor EndpointImpl and JaxWsServerFactoryBean, so that
> essentially everything in EndpointImpl is delegates to the
> JaxWsServerFactoryBean, EndpointImpl is just a wrapper on top of
> JaxWsServerFactoryBean. This will also fix CXF-558. Thoughts?


+1 - I didn't realize we didn't do the handler setup...

3. Q: When shall I use JaxWsServerFactoryBean and when shall I use
> ServerFactoryBean.
>    A: So basically if you are using JAX-WS frontend, you need to use
> JaxWsServerFactoryBean. Alternatively you can use simple frontend if your
> service implementation is a pojo, and you do not want to use any JAX-WS API
> or annotations, in this case you need to use ServerFactoryBean. More
> information about simple frontend can be found from
> http://cwiki.apache.org/confluence/display/CXF20DOC/Simple+Frontend


+1

Example 1, using JaxWsServerFactoryBean to create a JAX-WS service:
>         BookServiceImpl serviceObj = new BookServiceImpl();
>         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>         sf.setServiceClass(BookService.class);
>         // Use the HTTP Binding which understands the Java Rest
> Annotations
>         sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
>         sf.setAddress("http://localhost:9080/xml/");
>         sf.getServiceFactory().setInvoker(new BeanInvoker(serviceObj));
>         sf.create();


Actually now we don't need to explictly supply a BenaInvoker, we can just do
sf.setServiceBean(serviceObj); If you do this the JWSFB will look at the
@WebService annotation and find the appropriate interface as well. So the
bare minimum case is just:

JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setAddress("http://localhost:9080/xml/");
sf.setServiceBean(serviceObj);
sf.create();

Example 2, using ServerFactoryBean.to create a server from POJO:
> // Create our service implementation
> HelloImplhelloWorldImpl helloImpl = new HelloImpl();
>
> // Create our Server
> ServerFactoryBean svrFactory = new ServerFactoryBean();
> svrFactory.setServiceClass(Hello.class);
> svrFactory.setAddress("http://localhost:8080/Hello");
> svrFactory.setServiceBean(helloImpl);
> svrFactory.create();
>
> 4. Q. What APIs are available on JaxWsServerFactoryBean, and what's the
> meaning of them.
>    A. We need to document this clearly. e.g., how to enable MTOM, how to
> set BeanInvoker etc.


+1

5. Q: How to configure JaxWsServerFactoryBean and standard JAX-WS endpoint
> using spring configuration.
>    A: An example is as below
>   <bean id="greeterServerFactory"
>     class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
> init-method="create">
>     <property name="serviceClass" value="
> org.apache.hello_world_soap_http.GreeterImpl" />
>     <property name="serviceBean">
>       <bean class="org.apache.hello_world_soap_http.GreeterImpl"/>
>     </property>
>     <property name="address" value="/services/Greeter"/>
>     <property name="bus" ref="cxf"/>
>     <property name="bindingId" value="http://apache.org/cxf/binding/http
> "/>
>     <property name="properties">
>       <map>
>        <entry key="mtom-enabled" value="true"/>
>       </map>
>     </property>
>   </bean>


There really shouldn't be any need for the <bean> syntax at this point. I
just added support for <simple:server> as well.

   <jaxws:endpoint id="endpoint1"
>               implementor="org.apache.hello_world_soap_http.GreeterImpl"
>               address="/services/Greeter1"
>               wsdlLocation="/wsdl/hello_world.wsdl"
>    />
>
>
> 6. Q: I am also confused between the use of JaxWsServerFactoryBean and
> JaxWsSericeFactoryBean. For example, is the code snippet below a valid code?
>         JaxWsServiceFactoryBean serviceFactory = new
> JaxWsServiceFactoryBean();
>         serviceFactory.setBus(bus);
>         serviceFactory.setInvoker(new JAXWSMethodInvoker(impl));
>         serviceFactory.setServiceClass(impl.getClass());
>         serviceFactory.setWsdlURL(wsdlLoc);
>
>
>         JaxWsServerFactoryBean serverFactory = new
> JaxWsServerFactoryBean();
>         serverFactory.setServiceFactory(serviceFactory);
>         serverFactory.setBus(bus);
>         serverFactory.setEndpointName(new QName(portName));
>         serverFactory.setAddress(address);
>         serverFactory.setServiceClass(impl.getClass());
>         serverFactory.create();
>
>    A: ServiceFactorys construct the Service, ServerFactorys construct the
> Server. You dont need to create a JaxWsServiceFactoryBean by yourself, as
> JaxWsServerFactoryBean will create a default one. You do the code above only
> when you want to have your own customized JaxWsServiceFactoryBean.
>
>
>
Correct!

Seems you've got it under control :-)

- Dan

-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Usage of JaxWsServerFactoryBean

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi,

Recently I've seen some confusions in our user group around the usage of JaxWsServerFactoryBean, and to be honest, it confuses me sometimes as well. To better document this part, I have gathered couple of  questions, now I m inviting you to give out your answers and comments. Of course I know we programmers all hate writing documents, so I also provided some of my answers, but with no guarantee to be correct. Please review my answers and feel free to correct. Once this done, I ll put them into CXF documentation. 

1. Q: When shall I use standard JAX-WS API (e.g., javax.xml.ws.Endpoint.publish()) to publish a service and when shall I use JaxWsServerFactoryBean?
   A: Recently I've seen we are giving out a lot of code snippet to users that using JaxWsServerFactoryBean. Are we encouraging users to use  this JaxWsServerFactoryBean API, or we should encourage them to stick to standard JAX-WS APIs as much as possible? The next question followed up naturally is when I have to use JaxWsServerFactoryBean? My understanding is you use JaxWsServerFactoryBean only when you have to  programmatically set some CXF specific properties on JaxWsServerFactoryBean, e.g., set the BeanInvoker


2. Q: Is JaxWsServerFactoryBean exactly equivalent to javax.xml.ws.Endpoint.publish()? 
   A: Unfortunately, this is not the case. For example, handler chain and context injection is not done in JaxWsServerFactoryBean. There is a relevant JIRA issues about this (http://issues.apache.org/jira/browse/CXF-558).  I think we should refactor EndpointImpl and JaxWsServerFactoryBean, so that essentially everything in EndpointImpl is delegates to the JaxWsServerFactoryBean, EndpointImpl is just a wrapper on top of JaxWsServerFactoryBean. This will also fix CXF-558. Thoughts?


3. Q: When shall I use JaxWsServerFactoryBean and when shall I use ServerFactoryBean.
   A: So basically if you are using JAX-WS frontend, you need to use JaxWsServerFactoryBean. Alternatively you can use simple frontend if your service implementation is a pojo, and you do not want to use any JAX-WS API or annotations, in this case you need to use ServerFactoryBean. More information about simple frontend can be found from  http://cwiki.apache.org/confluence/display/CXF20DOC/Simple+Frontend


Example 1, using JaxWsServerFactoryBean to create a JAX-WS service:
        BookServiceImpl serviceObj = new BookServiceImpl();
        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
        sf.setServiceClass(BookService.class);
        // Use the HTTP Binding which understands the Java Rest Annotations
        sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
        sf.setAddress("http://localhost:9080/xml/");
        sf.getServiceFactory().setInvoker(new BeanInvoker(serviceObj));
        sf.create();


Example 2, using ServerFactoryBean.to create a server from POJO:
// Create our service implementation
HelloImplhelloWorldImpl helloImpl = new HelloImpl();

// Create our Server
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceClass(Hello.class);
svrFactory.setAddress("http://localhost:8080/Hello");
svrFactory.setServiceBean(helloImpl);
svrFactory.create();

4. Q. What APIs are available on JaxWsServerFactoryBean, and what's the meaning of them.
   A. We need to document this clearly. e.g., how to enable MTOM, how to set BeanInvoker etc.

5. Q: How to configure JaxWsServerFactoryBean and standard JAX-WS endpoint using spring configuration. 
   A: An example is as below
  <bean id="greeterServerFactory"
    class="org.apache.cxf.jaxws.JaxWsServerFactoryBean" init-method="create">
    <property name="serviceClass" value="org.apache.hello_world_soap_http.GreeterImpl" />
    <property name="serviceBean">
      <bean class="org.apache.hello_world_soap_http.GreeterImpl"/>
    </property>
    <property name="address" value="/services/Greeter"/>
    <property name="bus" ref="cxf"/>
    <property name="bindingId" value="http://apache.org/cxf/binding/http"/>
    <property name="properties">
      <map>
       <entry key="mtom-enabled" value="true"/>
      </map>
    </property>
  </bean>
  
   <jaxws:endpoint id="endpoint1" 
              implementor="org.apache.hello_world_soap_http.GreeterImpl"
              address="/services/Greeter1"
              wsdlLocation="/wsdl/hello_world.wsdl"
   />


6. Q: I am also confused between the use of JaxWsServerFactoryBean and JaxWsSericeFactoryBean. For example, is the code snippet below a valid code?
        JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
        serviceFactory.setBus(bus);
        serviceFactory.setInvoker(new JAXWSMethodInvoker(impl));
        serviceFactory.setServiceClass(impl.getClass());
        serviceFactory.setWsdlURL(wsdlLoc);


        JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
        serverFactory.setServiceFactory(serviceFactory);
        serverFactory.setBus(bus);
        serverFactory.setEndpointName(new QName(portName));
        serverFactory.setAddress(address);
        serverFactory.setServiceClass(impl.getClass());
        serverFactory.create();

   A: ServiceFactorys construct the Service, ServerFactorys construct the Server. You dont need to create a JaxWsServiceFactoryBean by yourself, as JaxWsServerFactoryBean will create a default one. You do the code above only when you want to have your own customized JaxWsServiceFactoryBean.



RE: Skipping some layers in the interceptor chain

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi Richard, 

Can't you use Dispatch interface? Sth like below shall allow you to skip unnecessary JAXB marshalling ( code snippet from CXF dispatch_provider sample)

        QName serviceName3 = new QName("http://apache.org/hello_world_soap_http", "SOAPService3");
        QName portName3 = new QName("http://apache.org/hello_world_soap_http", "SoapPort3"); 
        
        SOAPService3 service3 = new SOAPService3(wsdlURL, serviceName3);         
        DOMSource domReqPayload = new DOMSource(..................);           
        Dispatch<DOMSource> dispDOMSrcPayload = service3.createDispatch(portName3, 
                                                                        DOMSource.class, Mode.PAYLOAD);

        DOMSource domRespPayload = dispDOMSrcPayload.invoke(domReqPayload);       


Cheers,
Jervis


> -----Original Message-----
> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
> Sent: 2007?6?1? 23:33
> To: cxf-user@incubator.apache.org
> Subject: Skipping some layers in the interceptor chain
> 
> 
> I have the following requirement and was wondering whether 
> anybody could tell me if it is possible -
> 
> 1 - I have an XML string which represents the logical message 
> for a request
> 2 - I want to use this to make a request on an appropriate service 
> 3 - I want to catch the reply at the XML level without 
> creating a java object
> 4 - transform the reply using a XSL stylesheet to be the 
> logical message of another service
> 5 - send the logical message to the final service
> 
> This is for a generic data fetch. It requests data from a SOA 
> component, transforms the data into a set message, which is 
> sent to my datastore component. I don't want to write a new 
> component for every type of data source that I want to fetch 
> data from.
> 
> I have implemented the above using the original Celtix code, 
> but it has the following inefficiencies -
> 
> 1 - I load the XML from my config. unmarshal it into an 
> object and then use that to call my service which will 
> marshal as its first step
> 3 - the response is unmarshalled into a java object so I then 
> marshal it back to an XML stream to pass to the XSLT transformer
> 5 - I unmarshal the transformed XML into a java object and 
> use that to call my data storage service
> 
> Thanks
> 
> 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.
> 
> Consider the environment. Please don't print this e-mail 
> unless you really need to. 
>