Hello,
I have returned to my Enpoint.publish, with latest modifications...
org.apache.cxf.jaxws.EndpointImpl endpoint =
(org.apache.cxf.jaxws.EndpointImpl)Endpoint.publish(address, object);
ServerImpl server = endpoint.getServer();
Bus bus = BusFactory.newInstance().createBus();
QName serviceQName =
server.getEndpoint().getEndpointInfo().getService().getName();
QName portQName = server.getEndpoint().getEndpointInfo().getName();
// replace the observer
MessageObserver mo = server.getDestination().getMessageObserver();
System.out.println(">>> EXOMAN
MyServerLifeCycleListener.startServer() observer = " + mo);
if (mo == null) {
mo = new ChainInitiationObserver(server.getEndpoint(), bus);
}
if (mo instanceof ChainInitiationObserver) {
ChainInitiationObserver cio = (ChainInitiationObserver) mo;
MultipleEndpointObserver newMO = new MultipleEndpointObserver(bus);
newMO.getBindingInterceptors().add(new AttachmentInInterceptor());
newMO.getBindingInterceptors().add(new StaxInInterceptor());
// This will not work if we one of the endpoints disables message
// processing. But, if you've disabled message processing, you
// probably aren't going to use this feature.
newMO.getBindingInterceptors().add(new ReadHeadersInterceptor(bus));
newMO.getBindingInterceptors().add(new CheckFaultInterceptor());
// Add in a default selection interceptor
newMO.getRoutingInterceptors().add(new EndpointSelectionInterceptor());
newMO.getEndpoints().add(cio.getEndpoint());
mo = newMO;
}
server.getDestination().setMessageObserver(mo);
Does it correct?
Regards,
Alexey.
On Wed, Dec 10, 2008 at 7:00 PM, Sergey Beryozkin
<[EMAIL PROTECTED]> wrote:
> Hi
>
>> 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);
>> }
>>
> ok
>
>>
>> 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?
>
> That was just a sample code. I believe in startServer() you need to check if
> it's the service and port QNames you expect and if yes then replace an
> observer with a MutipleEndpointObserver on a given endpoint (was it the
> first one which Dan suggested ?) - but as I said last time I did not quite
> follow what exactly needs to be done for a multiport
> service with the same address to work
>
> Cheers, Sergey
>
>