cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From YUL <yulin...@dell.com>
Subject How to publish a custom object message through NotificationBroker
Date Mon, 26 Mar 2012 22:32:11 GMT
Hi All,

I'm a newbie in CXF ws-notification. I found the example in the
distribution/release and it runs fine. However, the example only shows how
to publish a String message to the broker. How do I publish a user-defined
object to the broker and then consumed by the client? 

I tried something as follows:

 notificationBroker.notify("MyTopic", 
               new  Add())
================================================
where Add is an object generated from XSD schema definition using JAXB:

@XmlRootElement(name = "add", namespace = "http://example/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "add", namespace = "http://example/", propOrder = {
    "arg0",
    "arg1"
})
public class Add {

    @XmlElement(name = "arg0", namespace = "")
    private int arg0;
    @XmlElement(name = "arg1", namespace = "")
    private int arg1;

    /**
     * 
     * @return
     *     returns int
     */
    public int getArg0() {
        return this.arg0;
    }

    /**
     * 
     * @param arg0
     *     the value for the arg0 property
     */
    public void setArg0(int arg0) {
        this.arg0 = arg0;
    }

    /**
     * 
     * @return
     *     returns int
     */
    public int getArg1() {
        return this.arg1;
    }

    /**
     * 
     * @param arg1
     *     the value for the arg1 property
     */
    public void setArg1(int arg1) {
        this.arg1 = arg1;
    }

}

However, when I ran the code, I got the following exception:

Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[javax.xml.bind.JAXBException: class
com.dell.pg.cim.networking.iominventory.Add nor any of its super class is
known to this context.]

I guess I must have missed something .... would appreciate if someone can
shed light on this issue...

Thanks very much,

YuLing

--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-publish-a-custom-object-message-through-NotificationBroker-tp5596534p5596534.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Mime
View raw message