cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From XiLai Dai <xl...@talend.com>
Subject RE: How to set wsdlLocation using API
Date Tue, 10 Jul 2012 01:47:36 GMT
Thanks Dan!
Really don't understand what the meaning of your codes :( but I try to find another way like
this: 

public class ServiceListenerImpl implements ServerLifeCycleListener{
    String wsdlURL = ......;
    public void startServer(Server server) {
        String origAddress = server.getEndpoint().getEndpointInfo().getAddress();
        ServerFactoryBean factoryBean = new ServerFactoryBean();
        factoryBean.setServiceClass(server.getEndpoint().getBinding().getBindingInfo().getService().getInterface().getService().getClass());
        factoryBean.setAddress(origAddress);
        factoryBean.setServer(server);
        factoryBean.setWsdlURL(wsdlURL);
        server = factoryBean.create();
    }
}

Is it feasible in this way?

Thanks.
Xilai
-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Tuesday, July 10, 2012 2:18 AM
To: users@cxf.apache.org
Cc: XiLai Dai
Subject: Re: How to set wsdlLocation using API

On Friday, July 06, 2012 01:58:27 AM XiLai Dai wrote:
> Thanks Freeman!
> Is there any Listener can be implemented at the stage of jaxws
> endpoint/client creating?

Not easily, no.   You COULD create a Bus lifecycle listener thing and when 
the bus is created, do something like:

final Configurer c = bus.getExtension(Configurer.class);
bus.setExtension(new Configurer() {
   .... override the methods and redirect to the "c" variable above
   ...  but configure the factories as needed.
}, Configurer.class);

Note that you can configure a bunch of things this way.  

Dan



 
> Thanks
> Xilai
> 
> -----Original Message-----
> From: Freeman Fang [mailto:freeman.fang@gmail.com] 
> Sent: Thursday, July 05, 2012 4:37 PM
> To: users@cxf.apache.org
> Subject: Re: How to set wsdlLocation using API
> 
> hmm, iirc you can't do it at this stage. When you already have server,  
> which means the service model(built from wsdl or built from the class)  
> init is done, that said, the server host the servicemodel which could  
> be built from the wsdl, but you must specify wsdlLocation at very  
> early stage.
> 
> It depend on how you get the server, you must publish some jaxws  
> endpoint using, right? Then you can specify wsdlLocation before you  
> publish the endpoint, then you can get server from the published  
> endpoint, code like
>          EndpointImpl ep = (EndpointImpl)Endpoint.create(new  
> DoubleItImpl());
>          ep.setWsdlLocation(wsdl.getPath());
>          ep.publish();
>          Server server = ep.getServer();
> Freeman
> On 2012-7-5, at 下午2:17, XiLai Dai wrote:
> 
> 
> > Hi,
> >
> >
> >
> > With spring xml configuration, we can set wsdlLocation like this:
> > <jaxws:endpoint id=" "
> > 
> >  wsdlLocation="file: ...."
> >  implementor="#ABC"
> >  address="...">
> > 
> > </jaxws:endpoint>
> >
> >
> >
> > How to set wsdlLocation with API? E.g. I have a  
> > ServerLifeCycleListener impl class:
> > public class ServiceListenerImpl implements ServerLifeCycleListener{
> > public void startServer(Server server) {
> > 
> >    //set a specific WSDL to server
> >    ?.......
> > 
> > }
> > }
> >
> >
> >
> > Thanks!
> > Xilai
> 
> 
> ---------------------------------------------
> Freeman Fang
> 
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com
Mime
View raw message