cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: adding soap headers to request/response
Date Thu, 21 Aug 2008 11:43:22 GMT
On Thursday 21 August 2008 2:27:49 am Gerson Galang wrote:
> Thanks Dan,
>
> I've sorted out the issues with Spring. Maven imported two version of
> Spring and the project was p icking up the old one so I couldn't find the
> method.
>
> I am using Aegis for data binding so I don't think I should be using
> JaxWsClientFactoryBean. 

No, you still need to use the JaxWsClientFactoryBean.   The databinding used 
is a separate decision from the frontend code.   In this case, 
BindingProvider is a JAX-WS specific thing, so you need to use the 
JaxWsClientFactoryBean.

Dan




> But I still had a go at what you were suggesting. 
> Have a look at lines 131-132 of this source..
>
> https://projects.arcs.org.au/trac/grisu/browser/trunk/grisu-client-cxf/src/
>main/java/org/vpac/grisu/client/control/CXFServiceInterfaceCreator.java
>
> The creation of the Service now works fine but the suggestion you gave Arul
> on this page..
>
> http://www.nabble.com/BindingProvider-from-JaxWsProxyFactoryBean-td18725385
>.html
>
> wouldn't work.  I tried to cast the service into BindingProvider but the
> application just throws a "cannot cast" exception
>
> > serviceInterface = (ServiceInterface) serviceFactory.create();
> > BindingProvider bp = (BindingProvider) serviceInterface;
>
> INFO: Creating Service {
> http://control.grisu.vpac.org/}ServiceInterfaceService from class
> org.vpac.grisu.control.ServiceInterface
> java.lang.ClassCastException: $Proxy13 cannot be cast to
> javax.xml.ws.BindingProvider
>     at
> org.vpac.grisu.client.control.CXFServiceInterfaceCreator.create(CXFServiceI
>nterfaceCreator.java:191) at
> org.vpac.grisu.client.control.ServiceInterfaceFactory.createInterface(Servi
>ceInterfaceFactory.java:119) at
> org.vpac.grisu.client.control.login.LoginHelpers.login(LoginHelpers.java:56
>) at
> org.vpac.grisu.client.view.swing.login.MyProxyLoginPanel.login(MyProxyLogin
>Panel.java:152) at
> org.vpac.grisu.client.view.swing.login.MyProxyLoginPanel.access$0(MyProxyLo
>ginPanel.java:142) at
> org.vpac.grisu.client.view.swing.login.MyProxyLoginPanel$3.actionPerformed(
>MyProxyLoginPanel.java:189) ...
>
> Is there any other way I can get hold of the BindingProvider object? I need
> it so I could add authentication information to the soap header.
>
> Thanks,
> Gerson
>
> On Thu, Aug 21, 2008 at 12:02 AM, Daniel Kulp <dkulp@apache.org> wrote:
> > First off, you MAY need to use the JaxWsClientFactoryBean instead of the
> > plain
> > ClientProxyFactoryBean.  I'm not sure where the "BindingProvider" methods
> > get
> > added.
> >
> > Your error, however, indicates a spring issue.  What version of Spring is
> > found?   Either that or some sort of classloader issue where spring is
> > coming
> > from two different classloaders.
> >
> > Dan
> >
> > On Wednesday 20 August 2008 1:40:57 am Gerson Galang wrote:
> > > Hi,
> > >
> > > I'm trying to add a soap header to the soap message I'm sending to the
> > > server to include authentication information. I found the link below
> >
> > which
> >
> > > suggested that I use BindingProvider's request context to include the
> > > header I created.
> >
> > http://cxf.apache.org/faq.html#FAQ-HowcanIaddsoapheaderstotherequest%252F
> >re
> >
> > >sponse%253F
> > >
> > > And then I found this thread which talks about how I can get the
> > > BindingProvider using the Bean Factory I am using
> >
> > (ClientProxyFactoryBean)
> >
> >
> > http://www.nabble.com/BindingProvider-from-JaxWsProxyFactoryBean-td187253
> >85
> >
> > >.html
> > >
> > > I wanted to check my implementation but the client throws the exception
> > > below. Any ideas?
> > >
> > > Exception occurred during event dispatching:
> > > java.lang.NoSuchMethodError:
> >
> > org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.set
> >Do
> >
> > >cumentLoader(Lorg/springframework/beans/factory/xml/DocumentLoader;)V at
> >
> > org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.<in
> >it
> >
> > >>(ControlledValidationXmlBeanDefinitionReader.java:84) at
> >
> > org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusAp
> >pl
> >
> > >icationContext.java:218) at
> >
> > org.springframework.context.support.AbstractRefreshableApplicationContext
> >.r
> >
> > >efreshBeanFactory(AbstractRefreshableApplicationContext.java:89) at
> >
> > org.springframework.context.support.AbstractApplicationContext.refresh(Ab
> >st
> >
> > >ractApplicationContext.java:269) at
> >
> > org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationCont
> >ex
> >
> > >t.java:86) at
> >
> > 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:
> > >93) at
> >
> > 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:
> > >87) at
> >
> > 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:
> > >65) at
> >
> > 
org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:
> > >54) at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69) at
> > > org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:106) at
> > > org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:97) at
> >
> > org.apache.cxf.endpoint.AbstractEndpointFactory.getBus(AbstractEndpointFa
> >ct
> >
> > >ory.java:73) at
> >
> > org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.initializeServic
> >eF
> >
> > >actory(AbstractWSDLBasedEndpointFactory.java:148) at
> >
> > org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(A
> >bs
> >
> > >tractWSDLBasedEndpointFactory.java:78) at
> >
> > org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:5
> >1)
> >
> > >     at
> >
> > org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryB
> >ea
> >
> > >n.java:97) at
> >
> > org.vpac.grisu.client.control.ServiceInterfaceFactory.createInterface(Ser
> >vi
> >
> > >ceInterfaceFactory.java:233) at
> >
> > org.vpac.grisu.client.control.login.LoginHelpers.login(LoginHelpers.java:
> >57
> >
> > >) at
> >
> > org.vpac.grisu.client.view.swing.login.MyProxyLoginPanel.login(MyProxyLog
> >in
> >
> > >Panel.java:152) at
> >
> > org.vpac.grisu.client.view.swing.login.MyProxyLoginPanel.access$0(MyProxy
> >Lo
> >
> > >ginPanel.java:142) at
> >
> > org.vpac.grisu.client.view.swing.login.MyProxyLoginPanel$3.actionPerforme
> >d(
> >
> > >MyProxyLoginPanel.java:189) at
> > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995
> > >) at
> >
> > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:23
> >18
> >
> > >) at
> >
> > 
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:
> > >387) at
> > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
> > >     at
> >
> > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListe
> >ne
> >
> > >r.java:236) at java.awt.Component.processMouseEvent(Component.java:6038)
> > >     at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
> > >     at java.awt.Component.processEvent(Component.java:5803)
> > >     at java.awt.Container.processEvent(Container.java:2058)
> > >     at java.awt.Component.dispatchEventImpl(Component.java:4410)
> > >     at java.awt.Container.dispatchEventImpl(Container.java:2116)
> > >     at java.awt.Component.dispatchEvent(Component.java:4240)
> > >     at
> > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
> > >     at
> > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
> > > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at
> > > java.awt.Container.dispatchEventImpl(Container.java:2102)
> > >     at java.awt.Window.dispatchEventImpl(Window.java:2429)
> > >     at java.awt.Component.dispatchEvent(Component.java:4240)
> > >     at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
> > >     at
> >
> > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.j
> >av
> >
> > >a:273) at
> >
> > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java
> >:1
> >
> > >83) at
> >
> > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java
> >:1
> >
> > >77) at java.awt.Dialog$1.run(Dialog.java:1039)
> > >     at java.awt.Dialog$3.run(Dialog.java:1091)
> > >     at java.security.AccessController.doPrivileged(Native Method)
> > >     at java.awt.Dialog.show(Dialog.java:1089)
> > >     at java.awt.Component.show(Component.java:1419)
> > >     at java.awt.Component.setVisible(Component.java:1372)
> > >     at java.awt.Window.setVisible(Window.java:801)
> > >     at java.awt.Dialog.setVisible(Dialog.java:979)
> > >     at
> > > org.vpac.grisu.client.view.swing.mainPanel.Grisu$5.run(Grisu.java:476)
> > >     at
> > > java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at
> > > java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
> > >     at
> >
> > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.j
> >av
> >
> > >a:273) at
> >
> > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java
> >:1
> >
> > >83) at
> >
> > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.j
> >av
> >
> > >a:173) at
> > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
> > > at
> > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
> > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
> > >
> > > I'm using CXF 2.1. Here's my client source (line 229)
> >
> > https://projects.arcs.org.au/trac/grisu/browser/branches/grisu-client-cxf
> >/s
> >
> > >rc/main/java/org/vpac/grisu/client/control/ServiceInterfaceFactory.java
> > >
> > > Thanks,
> > > Gerson
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message