Hello, Sergey
I have modified to
public class MyServerLifeCycleListener implements ServerLifeCycleListener {
public MyServerLifeCycleListener() {
Bus bus = BusFactory.newInstance().createBus();
ServerLifeCycleManager slcm =
bus.getExtension(ServerLifeCycleManager.class);
// 'this' implements ServerLifeCycleListener
slcm.registerListener(this);
}
next for
public void startServer(Server server) {
Bus bus = BusFactory.newInstance().createBus();
QName serviceQName =
server.getEndpoint().getEndpointInfo().getService().getName();
QName portQName = server.getEndpoint().getEndpointInfo().getName();
// replace the observer
MessageObserver observer = server.getDestination().getMessageObserver();
if (observer == null) {
observer = new ChainInitiationObserver(server.getEndpoint(), bus);
}
ServletFilterMessageObserver delegate =
new ServletFilterMessageObserver(observer, filter,
serviceQName, portQName);
server.getDestination().setMessageObserver(delegate);
}
I have a question
what is the filter variable for ServletFilterMessageObserver?
And, how can I use ServerLifeCycleListener for my service deployment?
Regards,
Alexey
On Wed, Dec 10, 2008 at 6:38 PM, Sergey Beryozkin
<[EMAIL PROTECTED]> wrote:
> Hi
>
> this is a code fragment showing an implementation of a
> ServiceLifeCycleListener interface, in the original fragment I posted in the
> other email, it was part of a constructor code I believe. Also, I was using
> a spring configuration there so a reference to a cxf bus is injected into a
> constructor.
>
> From the code you should be able to do
>
> BusFactory.getDefaultBus()
>
> Cheers, Sergey
>
>> Hello, Daniel
>>
>> Thanks.
>>
>> Where I should write code?
>>
>> ServerLifeCycleManager slcm =
>> bus.getExtension(ServerLifeCycleManager.class);
>> // 'this' implements ServerLifeCycleListener
>> sclm.register(this);
>>
>> I have no implementation for ServerLifeCycleListener and no bus variable.
>>
>> On Wed, Dec 10, 2008 at 6:20 PM, Sergey Beryozkin
>> <[EMAIL PROTECTED]> wrote:
>>>>
>>>> [INFO] Compilation failure
>>>> inconvertible types
>>>> found : javax.xml.ws.Endpoint
>>>> required: org.apache.cxf.endpoint.EndpointImpl
>>>
>>> you just picked up a wrong type, update the imports to include
>>> org.apache.cxf.jaxws.EndpointImpl
>>>
>>> Cheers, Sergey
>>>
>>>>
>>>> What it could be?
>>>> How can I cast the Endpoint to the specific
>>>> org.apache.cxf.jaxws.EndpointImpl?
>>>>
>>>> Regards,
>>>> Alexey
>>>>
>>>> On Wed, Nov 26, 2008 at 8:01 PM, Daniel Kulp <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>> On Wednesday 26 November 2008 5:04:12 am Alexey Zavizionov wrote:
>>>>>>
>>>>>> Thanks for reply, Dan
>>>>>>
>>>>>> How can I provide a multiple message observer for Endpoint.publish?
>>>>>> Any wiki documentation?
>>>>>
>>>>> If you cast the Endpoint to our specific
>>>>> org.apache.cxf.jaxws.EndpointImpl,
>>>>> you can call the getServer() call on it to get the Server object and
>>>>> then
>>>>> follow the stuff that Sergey provided.
>>>>>
>>>>> Dan
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> BTW, I have another way to deploy my service
>>>>>>
>>>>>> JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
>>>>>> //serverFactory.setBindingFactory(new HttpBindingInfoFactoryBean());
>>>>>> serverFactory.getServiceFactory().setDataBinding(new
>>>>>> JAXBDataBinding()); serverFactory.setServiceClass(object.getClass());
>>>>>> serverFactory.setAddress(address);
>>>>>> serverFactory.setBus(CXFBusFactory.getDefaultBus());
>>>>>> Server server = serverFactory.create();
>>>>>> serverFactory.getServiceFactory()
>>>>>> .getService()
>>>>>> .getInInterceptors()
>>>>>> .add(new LoggingInInterceptor());
>>>>>> serverFactory.getServiceFactory()
>>>>>> .getService()
>>>>>> .getOutInterceptors()
>>>>>> .add(new LoggingOutInterceptor());
>>>>>> Service service = server.getEndpoint().getService();
>>>>>> service.setInvoker(new BeanInvoker(object));
>>>>>> server.start();
>>>>>>
>>>>>> Have you a code to add that MultipleEndpointObserver in this case?
>>>>>>
>>>>>> Regards,
>>>>>> Alexey
>>>>>>
>>>>>> --
>>>>>> Alexey Zavizionov
>>>>>> eXo Platform SAS
>>>>>>
>>>>>> On Tue, Nov 25, 2008 at 9:55 PM, Daniel Kulp <[EMAIL PROTECTED]> wrote:
>>>>>> > On Tuesday 25 November 2008 10:19:54 am Alexey Zavizionov wrote:
>>>>>> >> Are there any thoughts?
>>>>>> >>
>>>>>> >> How can I publish several ports with one service name?
>>>>>> >>
>>>>>> >> String address = "http://my.service:8082/WSRPService";
>>>>>> >> Endpoint.publish(address, implementor);
>>>>>> >
>>>>>> > There isn't a way to do it. Each endpoint needs to have a unique
>>>>>> > URL.
>>>>>> > The ONLY exception we have right now is aSOAP 1.1 and a 1.2 endpoint
>>>>>> > can
>>>>>> > share the URL as the endpoint can be determined just from the
>>>>>> > namespace
>>>>>> > of the soap:envelope.
>>>>>> >
>>>>>> > You MAY be able to get it to work if you change the MessageObserver
>>>>>> > on
>>>>>> > the first registered endpoint to the MultipleEndpointObserver.
>>>>>> > Then
>>>>>> > add
>>>>>> > some interceptors to figure out which endpoint to hit (probably saaj
>>>>>> > interceptor + something to look a the element names or similar),
>>>>>> > then
>>>>>> > register the second. Not something I've tried though.
>>>>>> >
>>>>>> > Dan
>>>>>> >
>>>>>> >> Regards,
>>>>>> >> Alexey
>>>>>> >>
>>>>>> >> --
>>>>>> >> Alexey Zavizionov
>>>>>> >> eXo Platform SAS
>>>>>> >>
>>>>>> >> On Mon, Nov 24, 2008 at 3:08 PM, Alexey Zavizionov
>>>>>> >>
>>>>>> >> <[EMAIL PROTECTED]> wrote:
>>>>>> >> > How can I publish more than one port for a service?
>>>>>> >> >
>>>>>> >> > With generated sources I cannot do it due to the same address for
>>>>>> >> > both
>>>>>> >> > of them.
>>>>>> >> >
>>>>>> >> > <wsdl:service name="WSRPService">
>>>>>> >> > <wsdl:port binding="v2bind:WSRP_v2_Markup_Binding_SOAP"
>>>>>> >> > name="WSRP_v2_Markup_Service">
>>>>>> >> > <soap:address
>>>>>> >> > location="http://my.service:8082/WSRPService"/>
>>>>>> >> > </wsdl:port>
>>>>>> >> > <wsdl:port
>>>>>> >> > binding="v2bind:WSRP_v2_ServiceDescription_Binding_SOAP"
>>>>>> >> > name="WSRP_v2_ServiceDescription_Service">
>>>>>> >> > <soap:address
>>>>>> >> > location="http://my.service:8082/WSRPService"/>
>>>>>> >> > </wsdl:port>
>>>>>> >> >
>>>>>> >> >
>>>>>> >> > protected WSRPV2MarkupPortType_WSRPV2MarkupService_Server()
>>>>>> >> > throws
>>>>>> >> > Exception {
>>>>>> >> > System.out.println("Starting Server");
>>>>>> >> > Object implementor = new WSRPV2MarkupPortTypeImpl();
>>>>>> >> > String address = "http://my.service:8082/WSRPService";
>>>>>> >> > Endpoint.publish(address, implementor);
>>>>>> >> > }
>>>>>> >> >
>>>>>> >> > protected
>>>>>> >> >
>>>>>> >> >
>>>>>> >> > WSRPV2ServiceDescriptionPortType_WSRPV2ServiceDescriptionService_Serve
>>>>>> >> >r() throws Exception {
>>>>>> >> > System.out.println("Starting Server");
>>>>>> >> > Object implementor = new
>>>>>> >> > WSRPV2ServiceDescriptionPortTypeImpl(); String address =
>>>>>> >> > "http://my.service:8082/WSRPService"; Endpoint.publish(address,
>>>>>> >> > implementor);
>>>>>> >> > }
>>>>>> >> >
>>>>>> >> > ============================
>>>>>> >> > java.lang.RuntimeException: Soap 1.1 endpoint already registered
>>>>>> >> > on
>>>>>> >> > address /WSRPService
>>>>>> >> >
>>>>>> >> >
>>>>>> >> >
>>>>>> >> > org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBinding
>>>>>> >> >Fac tory.java:747)
>>>>>> >> > org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:122)
>>>>>> >> >
>>>>>> >> > org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:263)
>>>>>> >> > org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:201)
>>>>>> >> >
>>>>>> >> >
>>>>>> >> > org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(Provide
>>>>>> >> >rIm pl.java:84) javax.xml.ws.Endpoint.publish(Endpoint.java:47)
>>>>>> >> > ============================
>>>>>> >> >
>>>>>> >> >
>>>>>> >> > Regards,
>>>>>> >> > Alexey.
>>>>>> >
>>>>>> > --
>>>>>> > Daniel Kulp
>>>>>> > [EMAIL PROTECTED]
>>>>>> > http://dankulp.com/blog
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Daniel Kulp
>>>>> [EMAIL PROTECTED]
>>>>> http://dankulp.com/blog
>>>>>
>>>>
>>>
>>>
>>
>
>
>