Thanks a bunch for the ideas!

Here is what worked for me:

1. I defined my version of MyWSDLQueryHandler extends WSDLQueryHandler
(will override updateDoc and sneak in my header elements there later)

2. Defined my version of MyQueryHandlerRegistry implement
QueryHandlerRegistry
and did this little hack:

@Override
  public void setBus(Bus b)
  {
    super.setBus(b);
    
    QueryHandlerRegistry reg = b.getExtension(QueryHandlerRegistry.class);
    
    for (Iterator<QueryHandler> it = reg.getHandlers().iterator();
it.hasNext(); it.next())
    {
      if (it.next() instanceof WSDLQueryHandler) {
        MyWSDLQueryHandler myHandler = new MyWSDLQueryHandler(b);
        
        reg.registerHandler(myHandler,0);
        break;
      }
    } 
    
  }

note: remove from iterator failed with spring exception, so registerHandler
at position 0 seem to have 
put mine in front of an existing one.

3. finally to kick start all that I added my registry bean inside beans.xml

<bean id="myQueryHandlerRegistry"
class="demo.spring.handler.MyQueryHandlerRegistry"/>

PS
Is this something, the core team may be want to put in as an extensibility
feature?
May be let the handler registry be a spring configurable child of the bus
that would take handlers by name or something of that sort? First default
once would be loaded and if additional ones are given they would override
default once? just a suggestion..

Thanks again,
-Vitaly


bimargulies wrote:
> 
> We are a little outside my expertise, but I'd advise:
> 
> Define a bean class that gets the CXF bug injected.
> 
> 
>     @Resource
>     public void setBus(Bus bus) {
>         if (this.bus != bus) {
>             this.bus = bus;
>             registerWithBindingManager();
>         }
> 
> 
> And put the code in there. What I don't know is how to make sure that you
> get called at the right time: after the handler registry is set up. There
> are other people who, with any luck, will chime in.
> 
> 
> 
> On Sat, Oct 24, 2009 at 10:52 AM, vickatvuuch <vlisov...@gmail.com> wrote:
> 
>>
>> can it be done from the config file?
>>
>> so far I was using beans.xml to configure everything - bus and endpoints,
>> interceptors, etc.
>>
>>
>> bimargulies wrote:
>> >
>> > org.apache.cxf.transport.http.QueryHandlerRegistryImpl
>> >
>> > Walk the bus:
>> >
>> > for (QueryHandler qh :
>> > bus.getExtension(QueryHandlerRegistry.class).getHandlers()) {
>> > }
>> >
>> > and when you find the regular handler, replace it with yours.
>> >
>> > And perhaps open a JIRA suggesting that QueryHandlerRegistryImpl be
>> > friendlier to customization here.
>> >
>> >
>> > On Sat, Oct 24, 2009 at 10:17 AM, vickatvuuch <vlisov...@gmail.com>
>> wrote:
>> >
>> >>
>> >> Thanks!
>> >>
>> >> it sounds promising; do you mind sharing how to tell the bus that it
>> >> should
>> >> run my handler?
>> >>
>> >> Thanks,
>> >> -Vitaly
>> >>
>> >>
>> >> bimargulies wrote:
>> >> >
>> >> > The handler is registered as an object on the bus. You can register
>> >> yours
>> >> > instead.
>> >> >
>> >> > On Fri, Oct 23, 2009 at 6:19 PM, vickatvuuch <vlisov...@gmail.com>
>> >> wrote:
>> >> >
>> >> >>
>> >> >> Some digging led me to the WSDLQueryHandler.updateDoc method.
>> >> >> I could add my header elements as a sibling of each input element
>> in
>> >> >> there;
>> >> >> now the question is how can I override WSDLQueryHandler with my
>> >> >> implementation? is it possible to give CXF my derived class that
>> >> extends
>> >> >> WSDLQueryHandler?
>> >> >>
>> >> >>
>> >> >> vickatvuuch wrote:
>> >> >> >
>> >> >> > Hi CXF gurus!
>> >> >> >
>> >> >> > I need to add a custom header element to all my endpoints as a
>> place
>> >> >> for
>> >> >> > client to stick a session token.
>> >> >> >
>> >> >> > For example I need to add this message xml element once:
>> >> >> >
>> >> >> >   <wsdl:message name="Authentication">
>> >> >> >     <wsdl:part name="Authentication" type="tns1:SessionInfo"/>
>> >> >> >   </wsdl:message><br/>
>> >> >> >
>> >> >> > and a chunk of xml in bold below, to every port and every
>> >> >> operation:<br/>
>> >> >> >
>> >> >> > <wsdl:operation name="getFoo">
>> >> >> >       <wsdlsoap:operation soapAction="getFoo"/>
>> >> >> >       <wsdl:input name="getFoo">
>> >> >> >         <wsdlsoap:body
>> >> >> > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>> >> >> use="encoded"/>
>> >> >> >         <wsdlsoap:header message="impl:Authentication"
>> >> >> > part="Authentication"
>> >> >> > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>> >> >> use="encoded"/>
>> >> >> >       </wsdl:input>
>> >> >> >
>> >> >> > I'm debugging it at the WSDLManager level and wonder if there is
>> a
>> >> >> better
>> >> >> > way to do it?
>> >> >> > May be a plug in or through an interceptor?
>> >> >> >
>> >> >> > Any help is very much appreciated.
>> >> >> >
>> >> >> > Thanks,
>> >> >> > -Vitaly
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >> http://www.nabble.com/Custom-WSDL-header-tp26030841p26034038.html
>> >> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Custom-WSDL-header-tp26030841p26039401.html
>> >> Sent from the cxf-user mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/CXF-custom-WSDL-header-or-customizing-WSDLQueryHandler-document-tp26030841p26039721.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/CXF-custom-WSDL-header-or-customizing-WSDLQueryHandler-document-tp26030841p26040469.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to