Dan wrote:
>> No, this can be accomplished in just the normal cxf-servlet.xml.
If you 
>> use jaxws:endpoint element in your beans to publish it, you can add:
>>    <jaxws:serviceFactory>
>>        <bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>>                <property name="serviceConfigurations">
>> <snip!>

I'm giving this a try, but I'm getting errors at startup.  Cxf 2.1.3 /
tomcat 5.x / winxp.

Caused by: javax.xml.ws.WebServiceException:
java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed
data found for annotation element public abstract boolean
javax.xml.bind.annotation.XmlElement.required() (Found data of type
class java.lang.String[true])
The full stack trace is below, where the you can the println I added to
the method I'm overriding (just experimenting now).
So, my class is getting loaded but then experiencing problems later.
W/o the <jaxws:serviceFactory>, this is working fine.

I can only find one javax.xml.bind.annotation.XmlElement.  
I've googled for other versions of this file and can't find ones with
varying type -- only ones with and w/o this method.
Here is the one that comes with cxf:
########################################################################
###
F:\temp\xmlElement>javap -classpath jaxb-api-2.1.jar
javax.xml.bind.annotation.XmlElement

Compiled from "XmlElement.java"
public interface javax.xml.bind.annotation.XmlElement extends
java.lang.annotation.Annotation{
    public abstract java.lang.String name();
    public abstract boolean nillable();
    public abstract boolean required();
    public abstract java.lang.String namespace();
    public abstract java.lang.String defaultValue();
    public abstract java.lang.Class type();
}

Here is the class I'm injecting:
########################################################################
###
package com.fnf.dw.soap.util;

import org.apache.cxf.service.factory.DefaultServiceConfiguration;
import org.apache.cxf.service.model.MessagePartInfo;

public class RequiredFieldProcessor extends DefaultServiceConfiguration
{

    public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
                
                //This worked just fine
        
System.out.println("RequiredFieldProcessor#getWrapperPartMinOccurs [" +
mpi.getName() + "] toString [" + mpi.toString() + "]");
                
                return super.getWrapperPartMaxOccurs(mpi);
    }
}


Beans.xml
########################################################################
###
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:beans="http://www.springframework.org/schema/beans";
        xmlns:jaxws="http://cxf.apache.org/jaxws";
        xmlns:cxf="http://cxf.apache.org/core";
        xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>

        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
/>
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

        <jaxws:endpoint 
          id="idCreditLineForceApproval" 
        
implementor="com.fnf.dw.soap.sa.creditLine.CreditLineForceApprovalImpl05
" 
          address="/ForceApproval" />

        <jaxws:endpoint 
          id="idCreditLineInquiry" 
        
implementor="com.fnf.dw.soap.sa.creditLine.CreditLineInquiryImpl05" 
          address="/Inquiry">
          
        <jaxws:serviceFactory>
                <bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
                        <property name="serviceConfigurations">
                            <list>
                                        <bean
class="com.fnf.dw.soap.util.RequiredFieldProcessor"/>
                                    <bean
class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
                                </list>
                        </property>
                </bean>
        </jaxws:serviceFactory>
        </jaxws:endpoint>

    <bean id="logInbound"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
        
    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 

</beans> 

More detail on the stdout
########################################################################
#########
RequiredFieldProcessor#getWrapperPartMinOccurs
[{http://creditLine.sa.soap.dw.fnf.com/}UsernameToken] toString
[[MessagePartInfo
name={http://creditLine.sa.soap.dw.fnf.com/}UsernameToken,
ConcreteName={http://creditLine.sa.soap.dw.fnf.com/}UsernameToken]
RequiredFieldProcessor#getWrapperPartMinOccurs
[{http://creditLine.sa.soap.dw.fnf.com/}Request] toString
[[MessagePartInfo name={http://creditLine.sa.soap.dw.fnf.com/}Request,
ConcreteName={http://creditLine.sa.soap.dw.fnf.com/}Request]
RequiredFieldProcessor#getWrapperPartMinOccurs
[{http://creditLine.sa.soap.dw.fnf.com/}Response] toString
[[MessagePartInfo name={http://creditLine.sa.soap.dw.fnf.com/}Response,
ConcreteName={http://creditLine.sa.soap.dw.fnf.com/}Response]
2008-11-05 11:53:59,710 : DefaultSingletonBeanRegistry.destroySingletons
: Destroying singletons in
[EMAIL PROTECTED]
2ee6: defining beans
[cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apa
che.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.Bus
ExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apach
e.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryMana
ger,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.tr
ansport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apac
he.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.
apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.Serv
erRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf
.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHan
dlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache
.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,or
g.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.bin
ding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFa
ctory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.
transport.servlet.ServletTransportFactory,idCreditLineForceApproval,idCr
editLineInquiry,idCreditLineCancelApproval,idCreditLineApproval,logInbou
nd,logOutbound]; root of factory hierarchy
2008-11-05 11:53:59,742 : ContextLoader.initWebApplicationContext :
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'idCreditLineInquiry': Invocation of init method failed;
nested exception is javax.xml.ws.WebServiceException:
java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed
data found for annotation element public abstract boolean
javax.xml.bind.annotation.XmlElement.required() (Found data of type
class java.lang.String[true])
Caused by: javax.xml.ws.WebServiceException:
java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed
data found for annotation element public abstract boolean
javax.xml.bind.annotation.XmlElement.required() (Found data of type
class java.lang.String[true])
        at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
        at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:201)
        at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:394)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1242
)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1208)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.createBean(AbstractAutowireCapableBeanFactory.java:427)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObjec
t(AbstractBeanFactory.java:249)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.g
etSingleton(DefaultSingletonBeanRegistry.java:155)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:246)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:160)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.pre
InstantiateSingletons(DefaultListableBeanFactory.java:291)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(A
bstractApplicationContext.java:352)
        at
org.springframework.web.context.ContextLoader.createWebApplicationContex
t(ContextLoader.java:246)
        at
org.springframework.web.context.ContextLoader.initWebApplicationContext(
ContextLoader.java:189)
        at
org.springframework.web.context.ContextLoaderListener.contextInitialized
(ContextLoaderListener.java:49)
        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.j
ava:3831)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4323
)
        at
org.objectweb.jonas.web.catalina50.JOnASStandardContext.start(JOnASStand
ardContext.java:221)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.ja
va:823)
        at
org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:121
)
        at
org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerB
ase.java:143)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:805)
        at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
        at
org.objectweb.jonas.web.catalina50.CatalinaJWebContainerServiceImpl.doRe
gisterWar(CatalinaJWebContainerServiceImpl.java:567)
        at
org.objectweb.jonas.web.AbsJWebContainerServiceImpl.registerWar(AbsJWebC
ontainerServiceImpl.java:802)
        at
org.objectweb.jonas.web.AbsJWebContainerServiceImpl.doStart(AbsJWebConta
inerServiceImpl.java:368)
        at
org.objectweb.jonas.web.catalina50.CatalinaJWebContainerServiceImpl.doSt
art(CatalinaJWebContainerServiceImpl.java:303)
        at
org.objectweb.jonas.service.AbsServiceImpl.start(AbsServiceImpl.java:80)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.objectweb.jonas.web.wrapper.CatalinaJWebContainerServiceWrapper.invo
ke(CatalinaJWebContainerServiceWrapper.java:156)
        at
org.objectweb.jonas.web.wrapper.CatalinaJWebContainerServiceWrapper.star
t(CatalinaJWebContainerServiceWrapper.java:527)
        at
org.objectweb.jonas.service.ServiceManager.startServices(ServiceManager.
java:313)
        at org.objectweb.jonas.server.Server.start(Server.java:555)
        at org.objectweb.jonas.server.Server.main(Server.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.objectweb.jonas.server.Bootstrap.main(Bootstrap.java:97)
Caused by: java.lang.annotation.AnnotationTypeMismatchException:
Incorrectly typed data found for annotation element public abstract
boolean javax.xml.bind.annotation.XmlElement.required() (Found data of
type class java.lang.String[true])
        at
sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateExce
ption(AnnotationTypeMismatchExceptionProxy.java:38)
        at
sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvo
cationHandler.java:56)
        at $Proxy31.required(Unknown Source)
        at
com.sun.xml.bind.v2.model.annotation.XmlElementQuick.required(XmlElement
Quick.java:48)
        at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl.getTypes(ElementP
ropertyInfoImpl.java:139)
        at
com.sun.xml.bind.v2.model.impl.RuntimeElementPropertyInfoImpl.getTypes(R
untimeElementPropertyInfoImpl.java:86)
        at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size(ElementPro
pertyInfoImpl.java:78)
        at java.util.AbstractList$Itr.hasNext(AbstractList.java:416)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.ja
va:255)
        at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeM
odelBuilder.java:98)
        at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeM
odelBuilder.java:79)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.ja
va:209)
        at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeM
odelBuilder.java:93)
        at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeM
odelBuilder.java:79)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.jav
a:315)
        at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.jav
a:330)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextIm
pl.java:432)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:
286)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139
)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117
)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:214)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:375)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBData
Binding.java:532)
        at
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:282)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildService
FromClass(ReflectionServiceFactoryBean.java:359)
        at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromCla
ss(JaxWsServiceFactoryBean.java:519)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeSe
rviceModel(ReflectionServiceFactoryBean.java:410)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Refle
ctionServiceFactoryBean.java:189)
        at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsService
FactoryBean.java:164)
        at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
AbstractWSDLBasedEndpointFactory.java:100)
        at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:
117)
        at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBea
n.java:168)
        at
org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:336)
        at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:251)
        ... 47 more
2008-11-05 11:53:59,789 : StandardContext.start : Error listenerStart
2008-11-05 11:53:59,789 : StandardContext.start : Context startup failed
due to previous errors
########################################################################
#########

Thanks,
--Erik

-----Original Message-----
From: Daniel Kulp [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 03, 2008 1:10 PM
To: [email protected]
Cc: Ostermueller, Erik
Subject: Re: FW: [revisiting] jax-ws @WebParam "Required" annotation?

On Friday 31 October 2008 12:02:51 pm Ostermueller, Erik wrote:
> Hi, I'm still looking for feedback on this in case someone has got a 
> minute.
> --Erik

No, this can be accomplished in just the normal cxf-servlet.xml.      If
you 
use jaxws:endpoint element in your beans to publish it, you can add:

    <jaxws:serviceFactory>
        <bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
                <property name="serviceConfigurations">
                        <list>
                                <bean
class="com.your.ServiceConfiguration"/>

                                <bean
class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
                        </list>
                </property>
        </bean>
    </jaxws:serviceFactory>


Dan


>
> -----Original Message-----
> From: Ostermueller, Erik [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 28, 2008 8:30 AM
> To: Daniel Kulp; [email protected]
> Subject: RE: [revisiting] jax-ws @WebParam "Required" annotation?
>
> With our setup, CXFServlet loads with web.xml.
> I'm thinking I should subclass CXFServlet and then configure the
> services (like you showed me below) in that subclass after my
beans.xml
> is loaded.  Does that sound right?
>
> -----Original Message-----
> From: Daniel Kulp [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 27, 2008 2:21 PM
> To: [email protected]
> Cc: Ostermueller, Erik
> Subject: Re: [revisiting] jax-ws @WebParam "Required" annotation?
>
>
> If you use the ServerFactoryBeans (and not just
> "Endpoint.publish(...)"), you can call:
>
> factory.getServiceFactory().getConfigurations()
> or setConfigurations() to manipulate the list of configurations.  In
> general, you would do something like:
>
> factory.getServiceFactory().getConfigurations().add(0, yourConfig);
>
> Dan
>
> On Monday 27 October 2008 1:05:22 pm Ostermueller, Erik wrote:
> >
http://www.nabble.com/[EMAIL PROTECTED]
> > 83
> > 7631.html
> >
> > In the above thread, Dan wrote:
> > >> With 2.1.3, you will be able to write a ServiceConfiguration
object
> >
> > that
> >
> > >> can override the getWrapperPartMinOccurs method to return 1
instead
> >
> > of
> >
> > >> 0.  You can try the 2.1.3 snapshots if you want to play with
that.
> >
> > I'm doing java-first and would like to take a look at trying this.
> > How do you associate a custom ServiceConfiguration with the service?
> > Perhaps you could point me to a particular junit test that does
>
> this...
>
>
>
> --
> Daniel Kulp
> [EMAIL PROTECTED]
> http://dankulp.com/blog
>
> _____________
>
> The information contained in this message is proprietary and/or
> confidential. If you are not the
> intended recipient, please: (i) delete the message and all copies;
(ii)
> do not disclose,
> distribute or use the message in any manner; and (iii) notify the
sender
> immediately. In addition,
> please be aware that any message addressed to our domain is subject to
> archiving and review by
> persons other than the intended recipient. Thank you.
> _____________
>
> _____________
>
> The information contained in this message is proprietary and/or
> confidential. If you are not the intended recipient, please: (i)
delete the
> message and all copies; (ii) do not disclose, distribute or use the
message
> in any manner; and (iii) notify the sender immediately. In addition,
please
> be aware that any message addressed to our domain is subject to
archiving
> and review by persons other than the intended recipient. Thank you.
> _____________



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://dankulp.com/blog

_____________

The information contained in this message is proprietary and/or confidential. 
If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii) do not 
disclose, 
distribute or use the message in any manner; and (iii) notify the sender 
immediately. In addition, 
please be aware that any message addressed to our domain is subject to 
archiving and review by 
persons other than the intended recipient. Thank you.
_____________

Reply via email to