Hello,

I am trying to write a CXF-based webservice which consumes WS-Notifications. 
Using wsdl2java, I have obtained all necessary classes, but now I have trouble 
filling my subscription message. I do the following:

      org.oasis_open.docs.wsn.b_2.Subscribe _subscribe_subscribeRequest = new 
org.oasis_open.docs.wsn.b_2.Subscribe();
      TopicExpressionType topicExpression = new TopicExpressionType();
      
topicExpression.setDialect("http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple";);
      topicExpression.getContent().add("myTopic");
      _subscribe_subscribeRequest.setFilter(new FilterType());
      _subscribe_subscribeRequest.getFilter().getAny().add(topicExpression);
...
org.oasis_open.docs.wsn.b_2.SubscribeResponse _subscribe__return = 
port.subscribe(_subscribe_subscribeRequest);
      
When I try to run my service, the subscription fails with the following 
exception:

09.06.2009 11:10:21 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: unable to marshal type 
"org.oasis_open.docs.wsn.b_2.TopicExpressionType" as an element because it is 
missing an @XmlRootElement annotation
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:176)
        at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:166)
        at 
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:104)
        at 
org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
        at $Proxy45.subscribe(Unknown Source)
        at 
org.oasis_open.docs.wsn.bw_2.NotificationConsumer_NotificationConsumerPort_Server.subscribe(NotificationConsumer_NotificationConsumerPort_Server.java:69)
        at 
org.oasis_open.docs.wsn.bw_2.NotificationConsumer_NotificationConsumerPort_Server.main(NotificationConsumer_NotificationConsumerPort_Server.java:133)
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: unable to marshal type 
"org.oasis_open.docs.wsn.b_2.TopicExpressionType" as an element because it is 
missing an @XmlRootElement annotation]
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:331)
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:257)
        at 
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:381)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:155)
        ... 12 more
Caused by: com.sun.istack.SAXException2: unable to marshal type 
"org.oasis_open.docs.wsn.b_2.TopicExpressionType" as an element because it is 
missing an @XmlRootElement annotation
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:244)
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:303)
        at 
com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.serializeListBody(ArrayReferenceNodeProperty.java:114)
        at 
com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
        at 
com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:150)
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:151)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:185)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:305)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:312)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:71)
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:490)
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
        ... 16 more
09.06.2009 11:10:21 com.sun.xml.messaging.saaj.soap.ver1_2.Fault1_2Impl 
checkIfStandardFaultCode
SCHWERWIEGEND: SAAJ0435: {http://cxf.apache.org/faultcode}HandlerFault is not a 
standard Code value
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Marshalling 
Error: unable to marshal type "org.oasis_open.docs.wsn.b_2.TopicExpressionType" 
as an element because it is missing an @XmlRootElement annotation
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
        at $Proxy45.subscribe(Unknown Source)
        at 
org.oasis_open.docs.wsn.bw_2.NotificationConsumer_NotificationConsumerPort_Server.subscribe(NotificationConsumer_NotificationConsumerPort_Server.java:69)
        at 
org.oasis_open.docs.wsn.bw_2.NotificationConsumer_NotificationConsumerPort_Server.main(NotificationConsumer_NotificationConsumerPort_Server.java:133)
Caused by: org.apache.cxf.interceptor.Fault: Marshalling Error: unable to 
marshal type "org.oasis_open.docs.wsn.b_2.TopicExpressionType" as an element 
because it is missing an @XmlRootElement annotation
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:176)
        at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:166)
        at 
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:104)
        at 
org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
        ... 3 more
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: unable to marshal type 
"org.oasis_open.docs.wsn.b_2.TopicExpressionType" as an element because it is 
missing an @XmlRootElement annotation]
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:331)
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:257)
        at 
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:381)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:155)
        ... 12 more
Caused by: com.sun.istack.SAXException2: unable to marshal type 
"org.oasis_open.docs.wsn.b_2.TopicExpressionType" as an element because it is 
missing an @XmlRootElement annotation
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:244)
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:303)
        at 
com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.serializeListBody(ArrayReferenceNodeProperty.java:114)
        at 
com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
        at 
com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:150)
        at 
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:151)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:185)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:305)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:312)
        at 
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:71)
        at 
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:490)
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
        ... 16 more

The schema defines

<xsd:complexType name="TopicExpressionType" mixed="true">
<xsd:sequence>
        <xsd:any minOccurs="0" maxOccurs="1" processContents="lax" /> 
</xsd:sequence>
<xsd:attribute name="Dialect" type="xsd:anyURI" use="required" /> 
<xsd:anyAttribute /> 
</xsd:complexType>

and

<xsd:element name="TopicExpression" type="wsnt:TopicExpressionType" />

How can I tell the framework to use the element TopicExpression to marshal 
instances of TopicExpressionType? I use the FUSE Services Framework 2.1.3.1.

Thank you,

Anne Diefenbach
- FKIE-KOM -
*************************************************
Forschungsgesellschaft für
Angewandte Naturwissenschaften e. V. (FGAN)
Neuenahrer Str. 20, 53343 Wachtberg, Germany
E-Mail:  [email protected]
Web:    www.fgan.de
************************************************


Reply via email to