The JaxWsProxyFactoryBean seems to have all the stuff we needed from the 
JaxWsClientFactoryBean, plus the handler chain.  As the factory is never used 
anyway, just fields are copied out of it, changing the clientFac object type to 
JaxWsProxyFactoryBean was sufficient to allow the addition of the handler chain 
code.

I've tested this by creating a ridiculously simple handler and verifying that 
it gets called when configured in the jaxws:client element.

The patch is submitted into the issue.  Please go over it carefully if you can 
as I'm still really new to CXF and that code makes a lot of assumptions about 
how things work.  It seems to be successful from my tests by putting the 
ws-addressing element underneath the cxf:bus element or underneath the 
jaxws:client element or in the Dispatch factory method.  Also tried moving the 
cxf:logging element around and it works as expected too.  So I think it's good 
but just think it could use another pair of eyes.

Thanks,
Jesse

-----Original Message-----
From: Daniel Kulp [mailto:[email protected]] 
Sent: Tuesday, August 23, 2011 10:59 AM
To: [email protected]
Cc: Jesse Pangburn
Subject: Re: Can Dispatch API be used with jaxws:client Spring configuration?

On Monday, August 22, 2011 1:39:24 PM Jesse Pangburn wrote:
> There's now a bug for these configuration problems:
> https://issues.apache.org/jira/browse/CXF-3754.  I've submitted a patch and
> debugged through it to verify it allows setting properties, address, and
> bus now.  However, I could not find where to get the handler information. 
> I believe it should be there because a jaxws:client can have jaxws:handler
> entries according to the schema but I could not find that data in the
> client factory object that got configured by spring. 

Hmm...  they are on the JaxWsProxyFactoryBean.   Technically, the spring 
configuration is configuring a JaxWsProxyFactoryBean, not a 
JaxWsClientFactoryBean.   I'm wondering if it make sense to have the 
ServiceImpl create a JaxWsProxyFactoryBean, pass that into configureObject, 
then use the JaxWsClientFactoryBean out of there along with the handlers from 
there.     

The other option would be to move the handler related stuff from 
JaxWsProxyFactoryBean to JaxWsClientFactoryBean (and add wrapper methods to 
the proxy factory) so that the JaxWsClientFactoryBean would have everything 
you need.  I'd be OK with either approach.


Dan





> 
> Thanks,
> Jesse
> 
> -----Original Message-----
> From: Daniel Kulp [mailto:[email protected]]
> Sent: Friday, August 19, 2011 2:24 PM
> To: [email protected]
> Cc: Jesse Pangburn
> Subject: Re: Can Dispatch API be used with jaxws:client Spring
> configuration?
> On Friday, August 19, 2011 3:34:53 PM Jesse Pangburn wrote:
> > It seems that the ServiceImpl code is copying over stuff from the
> > following items (all this stuff is near the 620 line): features,
> > interceptors, conduit selector
> > 
> > It seems to do nothing with the following:
> > address, bus, properties, handlers
> > 
> > I don't know which of these things it SHOULD do.  To my noobie
> > viewpoint, it seems like it should copy the address information if
> > present, set the bus in the endpoint object if present, and copy any
> > properties found into the endpoint object.  I have no idea what to do
> > with handlers.
> 
> Yep.  I agree with all of that.    For the Handler, you would need to build
> up a HandlerChain and call dispatch.getBinding().setHandlerChain(..) with
> is.
> > Unless anyone disagrees, I'll make a bug report for this and patch it. 
> > I'll also patch the DispatchImpl to respect the ws-addressing feature
> > if set in the jaxws:client bean.
> 
> Perfect.  :-)
> 
> Dan
> 
> > Thanks,
> > Jesse
> > 
> > -----Original Message-----
> > From: Jesse Pangburn [mailto:[email protected]]
> > Sent: Friday, August 19, 2011 12:54 PM
> > To: Daniel Kulp; [email protected]
> > Subject: RE: Can Dispatch API be used with jaxws:client Spring
> > configuration?
> > 
> > When I debug into ServiceImpl line 610, it gets down to
> > org.apache.cxf.configuration.spring.ConfigurerImpl and line 151 throws:
> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
> > named
> > '{urn:ihe:iti:xds-b:2007}DocumentRegistry_Port_Soap12.jaxws-client.proxy
> > Fac tory' is defined
> > 
> > This is caught and logged FINE, which amusingly has the comment:
> >             // users often wonder why the settings in their
> >             configuration
> > 
> > files seem // to have no effect - the most common cause is that they
> > have
> > been using // incorrect bean ids
> > 
> > If I check my spring context and call context.getBeanDefinitionNames() I
> > get the following (among others):
> > registryClient.jaxws-client.proxyFactory
> > 
> > It does not have an entry with that name from the exception.  The
> > similar
> > entry is does have is from the id attribute, so I tried removing that id
> > attribute (and other things) but leaving the createdFromAPI (because
> > that
> > makes the .jaxws-client part of the name) from jaxws:client and just
> > leaving: <jaxws:client
> > name="{urn:ihe:iti:xds-b:2007}DocumentRegistry_Port_Soap12"
> > address="http://localhost:30320/tf6/services/xdsregistryb";
> > 
> >             createdFromAPI="true">
> >             <jaxws:features>
> >             
> >                     <wsa:addressing/>
> >             
> >             </jaxws:features>
> >     
> >     </jaxws:client>
> > 
> > Now the ConfigurerImpl matches the bean name and configured it and
> > ServiceImpl line 621 does apply the ws-addressing feature, but
> > unfortunately the addressing is wrong.  Probably same problem as
> > yesterday when I tried configuring it via the cxf:bus, that code in
> > DispatchImpl is probably not enabling ws-addressing.  Also, it uses the
> > address from the WSDL and ignores the address in the jaxws:client
> > element.
> > 
> > At least it's closer.
> > 
> > Thanks,
> > Jesse
> > 
> > -----Original Message-----
> > From: Daniel Kulp [mailto:[email protected]]
> > Sent: Thursday, August 18, 2011 7:51 PM
> > To: [email protected]
> > Cc: Jesse Pangburn
> > Subject: Re: Can Dispatch API be used with jaxws:client Spring
> > configuration?
> > 
> > 
> > This SHOULD be working.
> > 
> > Line 610 of ServiceImpl.java calls off to the configureObject with the
> > right name, so it should be configuring in the features and then
> > copying them over at line 621.   Any chance you can debug through that
> > code to see if anything looks strange?
> > 
> > Dan
> > 
> > On Thursday, August 18, 2011 3:11:40 PM Jesse Pangburn wrote:
> > > I'm trying to use the Spring jaxws:client configuration to put as
> > > much
> > > of
> > > the setup for my Dispatch API client into Spring as possible, but it
> > > seems to be ignoring it.
> > > 
> > > The following is the code I'm using to setup the dispatch client:
> > > URL wsdlURL = new
> > > URL("file:/home/jpangburn/Desktop/IHE/XDSb.Support.Materials.v9/wsdl
> > > /XDS .b_ DocumentRegistry.wsdl"); Service service =
> > > Service.create(wsdlURL, new QName("urn:ihe:iti:xds-b:2007",
> > > "DocumentRegistry_Service")); Dispatch<StaxSource> disp =
> > > service.createDispatch(new
> > > QName("urn:ihe:iti:xds-b:2007", "DocumentRegistry_Port_Soap12"),
> > > StaxSource.class, Service.Mode.PAYLOAD);
> > > 
> > > So the port is
> > > "{urn:ihe:iti:xds-b:2007}DocumentRegistry_Port_Soap12".
> > > In my Spring configuration I've tried this: <jaxws:client
> > > id="registryClient"
> > > name="{urn:ihe:iti:xds-b:2007}DocumentRegistry_Port_Soap12"
> > > address="http://localhost:30320/tf6/services/xdsregistryb";
> > > 
> > >   xmlns:ihe="urn:ihe:iti:xds-b:2007"
> > > 
> > > endpointName="ihe:DocumentRegistry_Port_Soap12"
> > > serviceName="ihe:DocumentRegistry_Service"
> > > 
> > >   createdFromAPI="true">
> > >   <jaxws:features>
> > >   
> > >           <wsa:addressing
> > >           xmlns:wsa="http://cxf.apache.org/ws/addressing"/>
> > >   
> > >   </jaxws:features>
> > > 
> > > </jaxws:client>
> > > 
> > > At first I hoped the "name" attribute would cause the matching at it
> > > would pick up my "address" attribute to set the destination address
> > > and
> > > my wsa:addressing feature to enable ws-addressing.  It did not, just
> > > sent to the same url defined in the WSDL.  So I added the
> > > endpointName
> > > and serviceName attributes, which also didn't help.  Then I added
> > > "createdFromAPI" which didn't do anything either.
> > > 
> > > I know the Spring configuration is working to some degree because if
> > > I
> > > put in a http:conduit that works just fine: <http:conduit
> > > name="{urn:ihe:iti:xds-b:2007}DocumentRegistry_Port_Soap12.http-cond
> > > uit"
> > > 
> > > <http:tlsClientParameters disableCNCheck="true">
> > > 
> > >   ...
> > > 
> > > Is jaxws:client configuration just not related to the Dispatch API
> > > at
> > > all? If so, why not?  This seems like it would be a nice way to
> > > setup
> > > address overrides, turn on/off jaxws:features, logging,
> > > interceptors,
> > > etc. for the Dispatch API.
> > > 
> > > Thanks,
> > > Jesse
-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com


Reply via email to