You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Dave Kallstrom <da...@gmail.com> on 2007/10/01 21:10:17 UTC

Versioning Interceptor Question

I have verified that my VersionInterceptor is returning the correct
endpoint. The constructor looks like this

    public VersionInterceptor() {
        super(Phase.POST_STREAM);
        addBefore(StaxInInterceptor.class.getName());
    }
my selectEndpoint(Message message, Set<Endpoint>set)
always returns the correct endpoint. However cxf appears to be ignoring the
return value and always uses the last endpoint listed in my cxf.xml file.
Which looks like this

<bean id="versionBean" class="com.widen.VersionInterceptor"/>
<jaxws:endpoint id="Orange" implementor="com.widen.OrangeImpl"
address="/HelloWorld" >
        <jaxws:serviceFactory>
            <bean class="
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"></bean>
        </jaxws:serviceFactory>
    </jaxws:endpoint>

    <jaxws:endpoint id="Banana" implementor="com.widen.BananaImpl"
address="/HelloWorld" >
        <jaxws:serviceFactory>
            <bean class="
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"></bean>
        </jaxws:serviceFactory>
    </jaxws:endpoint>
    <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="versionBean"/>
        </cxf:inInterceptors>
    </cxf:bus>
Here are my annotations
@WebService( endpointInterface="com.widen.Orange", targetNamespace=
Orange.namespace, serviceName="HelloWorld")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =
SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)

@WebService( endpointInterface="com.widen.Banana", targetNamespace=
Banana.namespace, serviceName="HelloWorld")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =
SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE
Dave Kallstrom

Re: Interop testing with axis2

Posted by Daniel Kulp <dk...@apache.org>.
Is this with CXF 2.0.2 or earlier?   I'm pretty sure from the stack trace 
that this was fixed in 2.0.2.

That said, I'd like to see the SOAP message and wsdl for the service if 
at all possible.   It looks like Axis is putting a soap header without a 
namespace qualification which is definitely discouraged.

Dan





On Monday 01 October 2007, Kang, Kamaljeet K. wrote:
> Hi,
>
> Hi,
>
> I am testing webservice implemented using Axi2 (ADB binding) with
> Client using CXF and I am getting the following exception. Can sombody
> please help me with this?
> Axis2 -> Axis2 and CXF -> CXF works fine for this service.
>
> Thanks
>
> Kamal kang
>
> Oct 1, 2007 3:25:57 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> java.lang.NullPointerException
>     at
> java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:157
>) at
> java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:730)
>     at
> org.apache.cxf.headers.HeaderManagerImpl.getHeaderProcessor(HeaderMana
>ge rImpl.java:50)
>     at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
>es sage(ReadHeadersInterceptor
>     at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
>es sage(ReadHeadersInterceptor
>     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rC hain.java:207)
>     at
> org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:395) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe
>sp onse(HTTPConduit.java:1959)
>     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HT
>TP Conduit.java:1806)
>     at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66
>) at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:574)
>     at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
>gI nterceptor.handleMessage(Me
>     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rC hain.java:207)
>     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
>     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
>     at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135
>) at $Proxy34.getActiveAlarms(Unknown Source)
>     at
> org.apache.cxf.alarm_retrieval.client.Client.getActiveAlarms(Client.ja
>va
>
> :208)
>
>     at
> org.apache.cxf.alarm_retrieval.client.Client.main(Client.java:72)
> javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault
> code, not set
>     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:169
>) at $Proxy34.getActiveAlarms(Unknown Source)
>     at
> org.apache.cxf.alarm_retrieval.client.Client.getActiveAlarms(Client.ja
>va
>
> :208)
>
>     at
> org.apache.cxf.alarm_retrieval.client.Client.main(Client.java:72)
> Caused by: java.lang.NullPointerException
>     at
> java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:157
>) at
> java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:730)
>     at
> org.apache.cxf.headers.HeaderManagerImpl.getHeaderProcessor(HeaderMana
>ge rImpl.java:50)
>     at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
>es sage(ReadHeadersInterceptor
>     at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
>es sage(ReadHeadersInterceptor
>     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rC hain.java:207)
>     at
> org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:395) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe
>sp onse(HTTPConduit.java:1959)
>     at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HT
>TP Conduit.java:1806)
>     at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66
>) at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:574)
>     at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
>gI nterceptor.handleMessage(Me
>     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rC hain.java:207)
>     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
>     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
>     at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135
>) ... 3 more
> ============================================================
> The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader
> of this message is not the intended recipient, or an employee
> or agent responsible for delivering this message to the
> intended recipient, you are hereby notified that any reproduction,
> dissemination or distribution of this communication is strictly
> prohibited. If you have received this communication in error,
> please notify us immediately by replying to the message and
> deleting it from your computer. Thank you. Tellabs
> ============================================================



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Interop testing with axis2

Posted by "Kang, Kamaljeet K." <Ka...@tellabs.com>.
Hi,

Hi,

I am testing webservice implemented using Axi2 (ADB binding) with Client
using CXF and I am getting the following exception. Can sombody please
help me with this? 
Axis2 -> Axis2 and CXF -> CXF works fine for this service.

Thanks

Kamal kang

Oct 1, 2007 3:25:57 PM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
java.lang.NullPointerException
    at
java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:157)
    at
java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:730)
    at
org.apache.cxf.headers.HeaderManagerImpl.getHeaderProcessor(HeaderManage
rImpl.java:50)
    at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor
    at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor
    at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:207)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:395)
    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
onse(HTTPConduit.java:1959)
    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP
Conduit.java:1806)
    at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
    at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:574)
    at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
nterceptor.handleMessage(Me
    at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:207)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
    at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
    at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
    at $Proxy34.getActiveAlarms(Unknown Source)
    at
org.apache.cxf.alarm_retrieval.client.Client.getActiveAlarms(Client.java
:208)
    at org.apache.cxf.alarm_retrieval.client.Client.main(Client.java:72)
javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault
code, not set
    at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:169)
    at $Proxy34.getActiveAlarms(Unknown Source)
    at
org.apache.cxf.alarm_retrieval.client.Client.getActiveAlarms(Client.java
:208)
    at org.apache.cxf.alarm_retrieval.client.Client.main(Client.java:72)
Caused by: java.lang.NullPointerException
    at
java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:157)
    at
java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:730)
    at
org.apache.cxf.headers.HeaderManagerImpl.getHeaderProcessor(HeaderManage
rImpl.java:50)
    at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor
    at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor
    at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:207)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:395)
    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
onse(HTTPConduit.java:1959)
    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP
Conduit.java:1806)
    at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
    at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:574)
    at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
nterceptor.handleMessage(Me
    at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:207)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
    at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
    at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
    ... 3 more
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================

Re: Versioning Interceptor Question

Posted by Dave Kallstrom <da...@gmail.com>.
Well I still cannot seem to figure out how to get this working. Here is my
latest attempt
public class VersionInterceptor extends
AbstractEndpointSelectionInterceptor{

    public VersionInterceptor() {
        super(Phase.READ);
        addBefore(EndpointSelectionInterceptor.class.getName());
    }

    @Override
    protected Endpoint selectEndpoint(Message message, Set<Endpoint> eps) {
        Exchange ex = message.getExchange();
        MultipleEndpointObserver observer = (MultipleEndpointObserver)
ex.getDestination().getMessageObserver();
        observer.getRoutingInterceptors().clear();
        observer.getRoutingInterceptors().add(this);
        String namespace = ((ServletDestination
)ex.getDestination()).getEndpointInfo().getName().getNamespaceURI();
        for(Endpoint ep : eps)
        {
            if(namespace.equals(ep.getEndpointInfo
().getName().getNamespaceURI()))
            {
                return ep;
            }
        }
        return null;
    }
}

It still will not return the correct endpoint. I must me missing something.
Any help would be greatly appreciated.

On 10/2/07, Daniel Kulp <dk...@apache.org> wrote:
>
>
> Dave,
>
> One option would be to register an interceptor that runs BEFORE the
> EndpointSelectionInterceptor in the interceptor chain.   That
> interceptor would grab the chain from the message and remove the
> EndpointSelectionInterceptor and then add a new one.
>
> The other option would be to get a hold of the MultipleEndpointObserver
> from the destination and replace it there.
>
> Hmm..... Just noticed the MultipleEndpointObserver isn't thread safe.
> I'll get that fixed.
>
>
> Dan
>
>
> On Tuesday 02 October 2007, Dave Kallstrom wrote:
> > It appears as though the EndpointSelectionInterceptor simple selects
> > the first endpoint that matches the address and soap version. So
> > unless there is someway to replace the EndpointSelectionInterceptor I
> > have have to find a different way to re-direct to the appropriate
> > endpoint.
> >
> > On 10/1/07, Dave Kallstrom <da...@gmail.com> wrote:
> > > I have verified that my VersionInterceptor is returning the correct
> > > endpoint. The constructor looks like this
> > >
> > >     public VersionInterceptor() {
> > >         super(Phase.POST_STREAM);
> > >         addBefore(StaxInInterceptor.class.getName ());
> > >     }
> > > my selectEndpoint(Message message, Set<Endpoint>set)
> > > always returns the correct endpoint. However cxf appears to be
> > > ignoring the return value and always uses the last endpoint listed
> > > in my cxf.xmlfile. Which looks like this
> > >
> > > <bean id="versionBean" class="com.widen.VersionInterceptor"/>
> > > <jaxws:endpoint id="Orange" implementor="com.widen.OrangeImpl"
> > > address="/HelloWorld" >
> > >         <jaxws:serviceFactory>
> > >             <bean class="
> > > org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"></bean>
> > >         </jaxws:serviceFactory>
> > >     </jaxws:endpoint>
> > >
> > >     <jaxws:endpoint id="Banana" implementor="com.widen.BananaImpl"
> > > address="/HelloWorld" >
> > >         <jaxws:serviceFactory>
> > >             <bean class="
> > > org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean "></bean>
> > >         </jaxws:serviceFactory>
> > >     </jaxws:endpoint>
> > >     <cxf:bus>
> > >         <cxf:inInterceptors>
> > >             <ref bean="versionBean"/>
> > >         </cxf:inInterceptors>
> > >     </cxf:bus>
> > > Here are my annotations
> > > @WebService( endpointInterface="com.widen.Orange", targetNamespace=
> > > Orange.namespace, serviceName="HelloWorld")
> > > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT , use =
> > > SOAPBinding.Use.LITERAL, parameterStyle =
> > > SOAPBinding.ParameterStyle.BARE)
> > >
> > > @WebService( endpointInterface="com.widen.Banana", targetNamespace=
> > > Banana.namespace, serviceName="HelloWorld")
> > > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =
> > > SOAPBinding.Use.LITERAL, parameterStyle =
> > > SOAPBinding.ParameterStyle.BARE Dave Kallstrom
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>



-- 
Dave Kallstrom

Re: Versioning Interceptor Question

Posted by Daniel Kulp <dk...@apache.org>.
Dave,

One option would be to register an interceptor that runs BEFORE the 
EndpointSelectionInterceptor in the interceptor chain.   That 
interceptor would grab the chain from the message and remove the 
EndpointSelectionInterceptor and then add a new one.

The other option would be to get a hold of the MultipleEndpointObserver 
from the destination and replace it there.

Hmm..... Just noticed the MultipleEndpointObserver isn't thread safe.   
I'll get that fixed.


Dan


On Tuesday 02 October 2007, Dave Kallstrom wrote:
> It appears as though the EndpointSelectionInterceptor simple selects
> the first endpoint that matches the address and soap version. So
> unless there is someway to replace the EndpointSelectionInterceptor I
> have have to find a different way to re-direct to the appropriate
> endpoint.
>
> On 10/1/07, Dave Kallstrom <da...@gmail.com> wrote:
> > I have verified that my VersionInterceptor is returning the correct
> > endpoint. The constructor looks like this
> >
> >     public VersionInterceptor() {
> >         super(Phase.POST_STREAM);
> >         addBefore(StaxInInterceptor.class.getName ());
> >     }
> > my selectEndpoint(Message message, Set<Endpoint>set)
> > always returns the correct endpoint. However cxf appears to be
> > ignoring the return value and always uses the last endpoint listed
> > in my cxf.xmlfile. Which looks like this
> >
> > <bean id="versionBean" class="com.widen.VersionInterceptor"/>
> > <jaxws:endpoint id="Orange" implementor="com.widen.OrangeImpl"
> > address="/HelloWorld" >
> >         <jaxws:serviceFactory>
> >             <bean class="
> > org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"></bean>
> >         </jaxws:serviceFactory>
> >     </jaxws:endpoint>
> >
> >     <jaxws:endpoint id="Banana" implementor="com.widen.BananaImpl"
> > address="/HelloWorld" >
> >         <jaxws:serviceFactory>
> >             <bean class="
> > org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean "></bean>
> >         </jaxws:serviceFactory>
> >     </jaxws:endpoint>
> >     <cxf:bus>
> >         <cxf:inInterceptors>
> >             <ref bean="versionBean"/>
> >         </cxf:inInterceptors>
> >     </cxf:bus>
> > Here are my annotations
> > @WebService( endpointInterface="com.widen.Orange", targetNamespace=
> > Orange.namespace, serviceName="HelloWorld")
> > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT , use =
> > SOAPBinding.Use.LITERAL, parameterStyle =
> > SOAPBinding.ParameterStyle.BARE)
> >
> > @WebService( endpointInterface="com.widen.Banana", targetNamespace=
> > Banana.namespace, serviceName="HelloWorld")
> > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =
> > SOAPBinding.Use.LITERAL, parameterStyle =
> > SOAPBinding.ParameterStyle.BARE Dave Kallstrom



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Versioning Interceptor Question

Posted by Dave Kallstrom <da...@gmail.com>.
It appears as though the EndpointSelectionInterceptor simple selects the
first endpoint that matches the address and soap version. So unless there is
someway to replace the EndpointSelectionInterceptor I have have to find a
different way to re-direct to the appropriate endpoint.

On 10/1/07, Dave Kallstrom <da...@gmail.com> wrote:
>
> I have verified that my VersionInterceptor is returning the correct
> endpoint. The constructor looks like this
>
>     public VersionInterceptor() {
>         super(Phase.POST_STREAM);
>         addBefore(StaxInInterceptor.class.getName ());
>     }
> my selectEndpoint(Message message, Set<Endpoint>set)
> always returns the correct endpoint. However cxf appears to be ignoring
> the return value and always uses the last endpoint listed in my cxf.xmlfile. Which looks like this
>
> <bean id="versionBean" class="com.widen.VersionInterceptor"/>
> <jaxws:endpoint id="Orange" implementor="com.widen.OrangeImpl"
> address="/HelloWorld" >
>         <jaxws:serviceFactory>
>             <bean class="
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"></bean>
>         </jaxws:serviceFactory>
>     </jaxws:endpoint>
>
>     <jaxws:endpoint id="Banana" implementor="com.widen.BananaImpl"
> address="/HelloWorld" >
>         <jaxws:serviceFactory>
>             <bean class="
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean "></bean>
>         </jaxws:serviceFactory>
>     </jaxws:endpoint>
>     <cxf:bus>
>         <cxf:inInterceptors>
>             <ref bean="versionBean"/>
>         </cxf:inInterceptors>
>     </cxf:bus>
> Here are my annotations
> @WebService( endpointInterface="com.widen.Orange", targetNamespace=
> Orange.namespace, serviceName="HelloWorld")
> @SOAPBinding(style = SOAPBinding.Style.DOCUMENT , use =
> SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)
>
> @WebService( endpointInterface="com.widen.Banana", targetNamespace=
> Banana.namespace, serviceName="HelloWorld")
> @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =
> SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE
> Dave Kallstrom




-- 
Dave Kallstrom