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/06 11:07:36 UTC

RE: DynamicClientFactory & skipping some layers

A new day and a clear mind and this turned out to be easy.

For those who are intersted this is what I've ended up with -

        QName serviceName = new QName("http://www.atkinsglobal.com/inform/configmanager/", "ConfigManagerService");
        QName portName = new QName("http://www.atkinsglobal.com/inform/configmanager/", "ConfigManagerPort");
        
        Service service;
        try
        {
            service = Service.create(new URL("http://localhost:9091/ConfigManager?wsdl"), serviceName);

            Dispatch<DOMSource> dispDOMSrcPayload = service.createDispatch(portName, 
                    DOMSource.class, Mode.PAYLOAD);
            
            DOMSource request = loadRequest("etc/request.xml");
            
            DOMSource response = dispDOMSrcPayload.invoke(request);        
    
            System.out.println("Response from server: " 
                    + response.getNode().getFirstChild().getTextContent()); 
        }
        catch (MalformedURLException e)
        {
            e.printStackTrace();
        }

loadRequest simply loads the file into a DOMSource object. 


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: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com] 
Sent: 06 June 2007 08:55
To: cxf-user@incubator.apache.org
Subject: RE: DynamicClientFactory

My use case is shown in my other email sibject "Skipping some layers in the interceptor chain"

I want to create a generic component to fetch data from a data provision service (using lots of transport formats, etc). The suggest has been to use jax-ws dispatch provider interface. I want to do this without having to create a service class at design time from the wsdl file. 

I want to be able to deploy my data fetch component, give it a wsdl file, some config about the request (possibly an XML message in a file), and an XSL transform to convert the reply into a message to my data storage component.

So my real question is how do I create a Service object from a wsdl file so that I can call dispath on it. 

I'm still not user if the dispatch provider goes through the binding layer so this might still not be my solution. I created a CSV binding for the old Celtix (which I haven't converted yet) and an FTP transport. I was using these to fetch data from CSV files on an FTP server, with the same generic data fetch component that was able to fetch data from a web service. As part of the migration of this component to CXF I wanted to look at making more efficient - it worked by calling wsdl2java at runtime to create a service class from the wsdl, it then loaded an XML file for the request, unmarshalled it into a java object before calling the service which would start my marshalling it mach to XML.  


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 Diephouse [mailto:dan@envoisolutions.com]
Sent: 05 June 2007 22:38
To: cxf-user@incubator.apache.org
Subject: Re: DynamicClientFactory

Why do you need a JAX-WS Service object from the DCF? The DCF is primarily for dynamic languages which want to create some proxy around a client and compile the client on the fly.
Thanks,
- Dan

On 6/5/07, Shaw, Richard A <ri...@atkinsglobal.com> wrote:
>
> Can I get a javax.xml.ws.Service object from the Client object 
> returned from by the DynamicClientFactory ?
>
> All I can find is a org.apache.cxf.service.Service object which I 
> don't think is the same.
>
> 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.
>



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


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

RE: DynamicClientFactory & skipping some layers

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi Ajay, yes you are right, we do not need these interceptors for Dispatch case. I will remove them.

Thanks,
Jervis

> -----Original Message-----
> From: Paibir, Ajay [mailto:ajay.paibir@iona.com]
> Sent: 2007?6?7? 18:19
> To: cxf-user@incubator.apache.org
> Subject: RE: DynamicClientFactory & skipping some layers
> 
> 
> Hi,
> 
> Imo for the Dispatch case MESSAGE or PAYLOAD mode there is no 
> need for 
> org.apache.cxf.jaxws.interceptors.HolderOutInterceptor
> org.apache.cxf.jaxws.interceptors.SwAOutInterceptor
> org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor
> 
> As the application layer provides the message/payload in the required
> format
> The org.apache.cxf.jaxws.DispatchImpl seems to be adding these
> interceptors 
> contributed via the endpoint interceptors.
> 
> Regards
> Ajay
> 
> > Dispatch does go through transport layer interceptors (to be 
> > more precisely, the MessageSenderInterceptor), however it 
> > does not go through bindind layer interceptors. If you dont 
> > mind me pointing to the source code, what you can see from 
> > DispatchImpl.getDispatchOutChain() is that DispatchImpl only 
> > adds interceptors contributed by bus, endpoint and itself, no 
> > interceptors from bindingFactory(eg, SoapBindingFactory) were 
> > added. This is because now that we've had XMLObject in place, 
> > let it be a SOAPMessage or Source, all we need to do is just 
> > to marshal this XML object into output stream, this is done 
> > by DispatchOutInterceptor.
> > 
> > Just in case you are curious, out interceptor chain for 
> > Dispatch is as below:
> > 
> > -----------org.apache.cxf.jaxws.interceptors.HolderOutInterceptor
> > -----------org.apache.cxf.jaxws.interceptors.SwAOutInterceptor
> > -----------org.apache.cxf.jaxws.interceptors.WrapperClassOutIn
> > terceptor
> > -----------org.apache.cxf.interceptor.MessageSenderInterceptor
> > -----------org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor
> > -----------org.apache.cxf.jaxws.interceptors.DispatchOutInterceptor
> > -----------org.apache.cxf.jaxws.handler.logical.LogicalHandler
> > OutInterceptor
> > -----------org.apache.cxf.interceptor.MessageSenderInterceptor
> > $MessageSenderEndingInterceptor
> > 
> 
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, 
> Dublin 4, Ireland
> 

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

RE: DynamicClientFactory & skipping some layers

Posted by "Paibir, Ajay" <aj...@iona.com>.
Hi,

Imo for the Dispatch case MESSAGE or PAYLOAD mode there is no need for 
org.apache.cxf.jaxws.interceptors.HolderOutInterceptor
org.apache.cxf.jaxws.interceptors.SwAOutInterceptor
org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor

As the application layer provides the message/payload in the required
format
The org.apache.cxf.jaxws.DispatchImpl seems to be adding these
interceptors 
contributed via the endpoint interceptors.

Regards
Ajay

> Dispatch does go through transport layer interceptors (to be 
> more precisely, the MessageSenderInterceptor), however it 
> does not go through bindind layer interceptors. If you dont 
> mind me pointing to the source code, what you can see from 
> DispatchImpl.getDispatchOutChain() is that DispatchImpl only 
> adds interceptors contributed by bus, endpoint and itself, no 
> interceptors from bindingFactory(eg, SoapBindingFactory) were 
> added. This is because now that we've had XMLObject in place, 
> let it be a SOAPMessage or Source, all we need to do is just 
> to marshal this XML object into output stream, this is done 
> by DispatchOutInterceptor.
> 
> Just in case you are curious, out interceptor chain for 
> Dispatch is as below:
> 
> -----------org.apache.cxf.jaxws.interceptors.HolderOutInterceptor
> -----------org.apache.cxf.jaxws.interceptors.SwAOutInterceptor
> -----------org.apache.cxf.jaxws.interceptors.WrapperClassOutIn
> terceptor
> -----------org.apache.cxf.interceptor.MessageSenderInterceptor
> -----------org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor
> -----------org.apache.cxf.jaxws.interceptors.DispatchOutInterceptor
> -----------org.apache.cxf.jaxws.handler.logical.LogicalHandler
> OutInterceptor
> -----------org.apache.cxf.interceptor.MessageSenderInterceptor
> $MessageSenderEndingInterceptor
> 

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

RE: DynamicClientFactory & skipping some layers

Posted by "Liu, Jervis" <jl...@iona.com>.
So you've got it. :-) Regarding whether or not dispatch provider goes through the binding layer, please see more comment in-line below.

Cheers,
Jervis

> -----Original Message-----
> From: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com]
> Sent: 2007?6?6? 17:08
> To: cxf-user@incubator.apache.org
> Subject: RE: DynamicClientFactory & skipping some layers
> 
> 
> A new day and a clear mind and this turned out to be easy.
> 
> For those who are intersted this is what I've ended up with -
> 
>         QName serviceName = new 
> QName("http://www.atkinsglobal.com/inform/configmanager/", 
> "ConfigManagerService");
>         QName portName = new 
> QName("http://www.atkinsglobal.com/inform/configmanager/", 
> "ConfigManagerPort");
>         
>         Service service;
>         try
>         {
>             service = Service.create(new 
> URL("http://localhost:9091/ConfigManager?wsdl"), serviceName);
> 
>             Dispatch<DOMSource> dispDOMSrcPayload = 
> service.createDispatch(portName, 
>                     DOMSource.class, Mode.PAYLOAD);
>             
>             DOMSource request = loadRequest("etc/request.xml");
>             
>             DOMSource response = 
> dispDOMSrcPayload.invoke(request);        
>     
>             System.out.println("Response from server: " 
>                     + 
> response.getNode().getFirstChild().getTextContent()); 
>         }
>         catch (MalformedURLException e)
>         {
>             e.printStackTrace();
>         }
> 
> loadRequest simply loads the file into a DOMSource object. 
> 
> 
> 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: Shaw, Richard A [mailto:richard.shaw@atkinsglobal.com] 
> Sent: 06 June 2007 08:55
> To: cxf-user@incubator.apache.org
> Subject: RE: DynamicClientFactory
> 
> My use case is shown in my other email sibject "Skipping some 
> layers in the interceptor chain"
> 
> I want to create a generic component to fetch data from a 
> data provision service (using lots of transport formats, 
> etc). The suggest has been to use jax-ws dispatch provider 
> interface. I want to do this without having to create a 
> service class at design time from the wsdl file. 
> 
> I want to be able to deploy my data fetch component, give it 
> a wsdl file, some config about the request (possibly an XML 
> message in a file), and an XSL transform to convert the reply 
> into a message to my data storage component.
> 
> So my real question is how do I create a Service object from 
> a wsdl file so that I can call dispath on it. 
> 
> I'm still not user if the dispatch provider goes through the 
> binding layer so this might still not be my solution. I 

Dispatch does go through transport layer interceptors (to be more precisely, the MessageSenderInterceptor), however it does not go through bindind layer interceptors. If you dont mind me pointing to the source code, what you can see from DispatchImpl.getDispatchOutChain() is that DispatchImpl only adds interceptors contributed by bus, endpoint and itself, no interceptors from bindingFactory(eg, SoapBindingFactory) were added. This is because now that we've had XMLObject in place, let it be a SOAPMessage or Source, all we need to do is just to marshal this XML object into output stream, this is done by DispatchOutInterceptor.

Just in case you are curious, out interceptor chain for Dispatch is as below:

-----------org.apache.cxf.jaxws.interceptors.HolderOutInterceptor
-----------org.apache.cxf.jaxws.interceptors.SwAOutInterceptor
-----------org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor
-----------org.apache.cxf.interceptor.MessageSenderInterceptor
-----------org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor
-----------org.apache.cxf.jaxws.interceptors.DispatchOutInterceptor
-----------org.apache.cxf.jaxws.handler.logical.LogicalHandlerOutInterceptor
-----------org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor



 

> created a CSV binding for the old Celtix (which I haven't 
> converted yet) and an FTP transport. I was using these to 
> fetch data from CSV files on an FTP server, with the same 
> generic data fetch component that was able to fetch data from 
> a web service. As part of the migration of this component to 
> CXF I wanted to look at making more efficient - it worked by 
> calling wsdl2java at runtime to create a service class from 
> the wsdl, it then loaded an XML file for the request, 
> unmarshalled it into a java object before calling the service 
> which would start my marshalling it mach to XML.  
> 
> 
> 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 Diephouse [mailto:dan@envoisolutions.com]
> Sent: 05 June 2007 22:38
> To: cxf-user@incubator.apache.org
> Subject: Re: DynamicClientFactory
> 
> Why do you need a JAX-WS Service object from the DCF? The DCF 
> is primarily for dynamic languages which want to create some 
> proxy around a client and compile the client on the fly.
> Thanks,
> - Dan
> 
> On 6/5/07, Shaw, Richard A <ri...@atkinsglobal.com> wrote:
> >
> > Can I get a javax.xml.ws.Service object from the Client object 
> > returned from by the DynamicClientFactory ?
> >
> > All I can find is a org.apache.cxf.service.Service object which I 
> > don't think is the same.
> >
> > 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.
> >
> 
> 
> 
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
> 
> 
> This message has been scanned for viruses by MailControl - 
> (see http://bluepages.wsatkins.co.uk/?6875772)
> 

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