You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jdmichal <ju...@sri.com> on 2009/07/22 00:53:39 UTC

cxf-2.2: JAXBDataBinding causing Spring-2.5.6 NamespaceHandler issues

I am using CXF to transform a WSDL into Java code. My WSDL is defined in XML
namespace "http://my.wsdl.namespace" and the files are generated to the Java
namespace "my.wsdl.namespace". The WSDL uses "xsd:anyType", and the data
elements being sent are in namespace "my.data.namespace". Because the WSDL
does not actually contain the data definitions, I am attempting to use a
JAXBDataBinding in order to allow the backend to unmarshall the elements
into something other than
"com.sun.org.apache.xerces.internal.dom.ElementNSImpl".

I set a JAXBDataBinding as so in beans.xml:

<jaxws:dataBinding>
    <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
        <constructor-arg index="0">
            <bean class="javax.xml.bind.JAXBContext"
factory-method="newInstance">
                <constructor-arg index="0"
value="my.wsdl.namespace:my.data.namespace"/>
            </bean>
        </constructor-arg>
    </bean>
</jaxws:dataBinding>


What I end up seeing in the Tomcat log is this:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for XML
schema namespace [http://my.wsdl.namespace]
Offending resource: ServletContext resource [/WEB-INF/beans.xml]


Note that the namespace indicated is that of my WSDL file.

Any information is appreciated. Been bashing my head against this one for a
few hours now. Can find very little useful on the web regarding this.
-- 
View this message in context: http://www.nabble.com/cxf-2.2%3A-JAXBDataBinding-causing-Spring-2.5.6-NamespaceHandler-issues-tp24597238p24597238.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: cxf-2.2: JAXBDataBinding causing Spring-2.5.6 NamespaceHandler issues

Posted by jdmichal <ju...@sri.com>.
Well, adding the data types to the WSDL but keeping the types in the messages
as xsd:anyType apparently stopped the PermGen errors, while letting CXF
properly un-/marshall the messages.

When I get some free time I'm going to try the @XmlSeeAlso annotation on the
service implementation and see if that works also. We regenerate the WSDL
code each time we build, so putting it anywhere else would just get cleared
out anyway. I'll post the results here.

I'd still like to know what was going on with the JAXBDataBinding failing
though :-\

~Justin


dkulp wrote:
> 
> On Wed July 22 2009 3:14:39 pm jdmichal wrote:
>> Thanks for the suggestion. Just a clarification, what class do you mean I
>> annotate when you say JAX-WS SEI interface?
> 
> Normally (but this isn't required), you would have an interface that
> defines 
> the methods for the service.   The @WebService annotation would point to
> that 
> as the "endpointInterface".   In most cases, you can add the XmlSeeAlso to 
> that interface and it will be picked up.   Adding it to the actual 
> implementation should also work.    Putting it on the interface has an 
> advantage IF you use the the same interface for the client and server as
> both 
> would be able to pick it up.
> 
> Dan
> 
> 
>>
>> Later today we'll be trying to import the types XSDs to the WSDL, but
>> keep
>> the xsd:anyType in the message. Hopefully this will be enough for CXF to
>> hook them up together.
>>
>> I should explain that the whole reason of switching to xsd:anyType to
>> start
>> with was because having these imports (which are massive) in the WSDL was
>> causing PermGen OutOfMemory errors when generating a proxy via
>> javax.xml.ws.Service#getPort. Then we found out that the parameter we
>> thought we were giving the JVM to increase the PermGen space wasn't
>> actually making it into the JVM. This time we'll try again, but making
>> sure
>> that parameter gets through.
>>
>> ~Justin
>>
>> dkulp wrote:
>> > No idea on the error message.
>> >
>> > However, one possible solution that may work for you is to add an
>> > @XmlSeeAlso
>> > annotation onto the JAX-WS SEI interface (and/or the impl class) that
>> > points
>> > to your jaxb beans that you really would be sending.  (or the
>> > ObjectFactory
>> > for them)   That SHOULD then make sure they are added into the
>> > JAXBContext that CXF would created.   Probably added to the WSDL as
>> well.
>> >
>> > Dan
>> >
>> > On Tue July 21 2009 6:53:39 pm jdmichal wrote:
>> >> I am using CXF to transform a WSDL into Java code. My WSDL is defined
>> in
>> >> XML namespace "http://my.wsdl.namespace" and the files are generated
>> to
>> >> the
>> >> Java namespace "my.wsdl.namespace". The WSDL uses "xsd:anyType", and
>> the
>> >> data elements being sent are in namespace "my.data.namespace". Because
>> >> the
>> >> WSDL does not actually contain the data definitions, I am attempting
>> to
>> >> use
>> >> a JAXBDataBinding in order to allow the backend to unmarshall the
>> >> elements
>> >> into something other than
>> >> "com.sun.org.apache.xerces.internal.dom.ElementNSImpl".
>> >>
>> >> I set a JAXBDataBinding as so in beans.xml:
>> >>
>> >> <jaxws:dataBinding>
>> >>     <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
>> >>         <constructor-arg index="0">
>> >>             <bean class="javax.xml.bind.JAXBContext"
>> >> factory-method="newInstance">
>> >>                 <constructor-arg index="0"
>> >> value="my.wsdl.namespace:my.data.namespace"/>
>> >>             </bean>
>> >>         </constructor-arg>
>> >>     </bean>
>> >> </jaxws:dataBinding>
>> >>
>> >>
>> >> What I end up seeing in the Tomcat log is this:
>> >>
>> >>
>> org.springframework.beans.factory.parsing.BeanDefinitionParsingException
>> >>: Configuration problem: Unable to locate Spring NamespaceHandler for
>> XML
>> >> schema namespace [http://my.wsdl.namespace]
>> >> Offending resource: ServletContext resource [/WEB-INF/beans.xml]
>> >>
>> >>
>> >> Note that the namespace indicated is that of my WSDL file.
>> >>
>> >> Any information is appreciated. Been bashing my head against this one
>> >> for a
>> >> few hours now. Can find very little useful on the web regarding this.
>> >
>> > --
>> > Daniel Kulp
>> > dkulp@apache.org
>> > http://www.dankulp.com/blog
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/cxf-2.2%3A-JAXBDataBinding-causing-Spring-2.5.6-NamespaceHandler-issues-tp24597238p24631143.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: cxf-2.2: JAXBDataBinding causing Spring-2.5.6 NamespaceHandler issues

Posted by Daniel Kulp <dk...@apache.org>.
On Wed July 22 2009 3:14:39 pm jdmichal wrote:
> Thanks for the suggestion. Just a clarification, what class do you mean I
> annotate when you say JAX-WS SEI interface?

Normally (but this isn't required), you would have an interface that defines 
the methods for the service.   The @WebService annotation would point to that 
as the "endpointInterface".   In most cases, you can add the XmlSeeAlso to 
that interface and it will be picked up.   Adding it to the actual 
implementation should also work.    Putting it on the interface has an 
advantage IF you use the the same interface for the client and server as both 
would be able to pick it up.

Dan


>
> Later today we'll be trying to import the types XSDs to the WSDL, but keep
> the xsd:anyType in the message. Hopefully this will be enough for CXF to
> hook them up together.
>
> I should explain that the whole reason of switching to xsd:anyType to start
> with was because having these imports (which are massive) in the WSDL was
> causing PermGen OutOfMemory errors when generating a proxy via
> javax.xml.ws.Service#getPort. Then we found out that the parameter we
> thought we were giving the JVM to increase the PermGen space wasn't
> actually making it into the JVM. This time we'll try again, but making sure
> that parameter gets through.
>
> ~Justin
>
> dkulp wrote:
> > No idea on the error message.
> >
> > However, one possible solution that may work for you is to add an
> > @XmlSeeAlso
> > annotation onto the JAX-WS SEI interface (and/or the impl class) that
> > points
> > to your jaxb beans that you really would be sending.  (or the
> > ObjectFactory
> > for them)   That SHOULD then make sure they are added into the
> > JAXBContext that CXF would created.   Probably added to the WSDL as well.
> >
> > Dan
> >
> > On Tue July 21 2009 6:53:39 pm jdmichal wrote:
> >> I am using CXF to transform a WSDL into Java code. My WSDL is defined in
> >> XML namespace "http://my.wsdl.namespace" and the files are generated to
> >> the
> >> Java namespace "my.wsdl.namespace". The WSDL uses "xsd:anyType", and the
> >> data elements being sent are in namespace "my.data.namespace". Because
> >> the
> >> WSDL does not actually contain the data definitions, I am attempting to
> >> use
> >> a JAXBDataBinding in order to allow the backend to unmarshall the
> >> elements
> >> into something other than
> >> "com.sun.org.apache.xerces.internal.dom.ElementNSImpl".
> >>
> >> I set a JAXBDataBinding as so in beans.xml:
> >>
> >> <jaxws:dataBinding>
> >>     <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
> >>         <constructor-arg index="0">
> >>             <bean class="javax.xml.bind.JAXBContext"
> >> factory-method="newInstance">
> >>                 <constructor-arg index="0"
> >> value="my.wsdl.namespace:my.data.namespace"/>
> >>             </bean>
> >>         </constructor-arg>
> >>     </bean>
> >> </jaxws:dataBinding>
> >>
> >>
> >> What I end up seeing in the Tomcat log is this:
> >>
> >> org.springframework.beans.factory.parsing.BeanDefinitionParsingException
> >>: Configuration problem: Unable to locate Spring NamespaceHandler for XML
> >> schema namespace [http://my.wsdl.namespace]
> >> Offending resource: ServletContext resource [/WEB-INF/beans.xml]
> >>
> >>
> >> Note that the namespace indicated is that of my WSDL file.
> >>
> >> Any information is appreciated. Been bashing my head against this one
> >> for a
> >> few hours now. Can find very little useful on the web regarding this.
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog

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

Re: cxf-2.2: JAXBDataBinding causing Spring-2.5.6 NamespaceHandler issues

Posted by jdmichal <ju...@sri.com>.
Thanks for the suggestion. Just a clarification, what class do you mean I
annotate when you say JAX-WS SEI interface?

Later today we'll be trying to import the types XSDs to the WSDL, but keep
the xsd:anyType in the message. Hopefully this will be enough for CXF to
hook them up together.

I should explain that the whole reason of switching to xsd:anyType to start
with was because having these imports (which are massive) in the WSDL was
causing PermGen OutOfMemory errors when generating a proxy via
javax.xml.ws.Service#getPort. Then we found out that the parameter we
thought we were giving the JVM to increase the PermGen space wasn't actually
making it into the JVM. This time we'll try again, but making sure that
parameter gets through.

~Justin


dkulp wrote:
> 
> 
> No idea on the error message.
> 
> However, one possible solution that may work for you is to add an
> @XmlSeeAlso 
> annotation onto the JAX-WS SEI interface (and/or the impl class) that
> points 
> to your jaxb beans that you really would be sending.  (or the
> ObjectFactory 
> for them)   That SHOULD then make sure they are added into the JAXBContext 
> that CXF would created.   Probably added to the WSDL as well.
> 
> Dan
> 
> 
> 
> On Tue July 21 2009 6:53:39 pm jdmichal wrote:
>> I am using CXF to transform a WSDL into Java code. My WSDL is defined in
>> XML namespace "http://my.wsdl.namespace" and the files are generated to
>> the
>> Java namespace "my.wsdl.namespace". The WSDL uses "xsd:anyType", and the
>> data elements being sent are in namespace "my.data.namespace". Because
>> the
>> WSDL does not actually contain the data definitions, I am attempting to
>> use
>> a JAXBDataBinding in order to allow the backend to unmarshall the
>> elements
>> into something other than
>> "com.sun.org.apache.xerces.internal.dom.ElementNSImpl".
>>
>> I set a JAXBDataBinding as so in beans.xml:
>>
>> <jaxws:dataBinding>
>>     <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
>>         <constructor-arg index="0">
>>             <bean class="javax.xml.bind.JAXBContext"
>> factory-method="newInstance">
>>                 <constructor-arg index="0"
>> value="my.wsdl.namespace:my.data.namespace"/>
>>             </bean>
>>         </constructor-arg>
>>     </bean>
>> </jaxws:dataBinding>
>>
>>
>> What I end up seeing in the Tomcat log is this:
>>
>> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
>> Configuration problem: Unable to locate Spring NamespaceHandler for XML
>> schema namespace [http://my.wsdl.namespace]
>> Offending resource: ServletContext resource [/WEB-INF/beans.xml]
>>
>>
>> Note that the namespace indicated is that of my WSDL file.
>>
>> Any information is appreciated. Been bashing my head against this one for
>> a
>> few hours now. Can find very little useful on the web regarding this.
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/cxf-2.2%3A-JAXBDataBinding-causing-Spring-2.5.6-NamespaceHandler-issues-tp24597238p24612724.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: cxf-2.2: JAXBDataBinding causing Spring-2.5.6 NamespaceHandler issues

Posted by Daniel Kulp <dk...@apache.org>.
No idea on the error message.

However, one possible solution that may work for you is to add an @XmlSeeAlso 
annotation onto the JAX-WS SEI interface (and/or the impl class) that points 
to your jaxb beans that you really would be sending.  (or the ObjectFactory 
for them)   That SHOULD then make sure they are added into the JAXBContext 
that CXF would created.   Probably added to the WSDL as well.

Dan



On Tue July 21 2009 6:53:39 pm jdmichal wrote:
> I am using CXF to transform a WSDL into Java code. My WSDL is defined in
> XML namespace "http://my.wsdl.namespace" and the files are generated to the
> Java namespace "my.wsdl.namespace". The WSDL uses "xsd:anyType", and the
> data elements being sent are in namespace "my.data.namespace". Because the
> WSDL does not actually contain the data definitions, I am attempting to use
> a JAXBDataBinding in order to allow the backend to unmarshall the elements
> into something other than
> "com.sun.org.apache.xerces.internal.dom.ElementNSImpl".
>
> I set a JAXBDataBinding as so in beans.xml:
>
> <jaxws:dataBinding>
>     <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
>         <constructor-arg index="0">
>             <bean class="javax.xml.bind.JAXBContext"
> factory-method="newInstance">
>                 <constructor-arg index="0"
> value="my.wsdl.namespace:my.data.namespace"/>
>             </bean>
>         </constructor-arg>
>     </bean>
> </jaxws:dataBinding>
>
>
> What I end up seeing in the Tomcat log is this:
>
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> Configuration problem: Unable to locate Spring NamespaceHandler for XML
> schema namespace [http://my.wsdl.namespace]
> Offending resource: ServletContext resource [/WEB-INF/beans.xml]
>
>
> Note that the namespace indicated is that of my WSDL file.
>
> Any information is appreciated. Been bashing my head against this one for a
> few hours now. Can find very little useful on the web regarding this.

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