cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: How to publish a custom object message through NotificationBroker
Date Tue, 27 Mar 2012 17:02:09 GMT
On Monday, March 26, 2012 03:32:11 PM YUL wrote:
> 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 just committed some changes on trunk for 2.6 to hopefully support this.  I 
had to change a bunch of API's so not really backportable.  

Is there any chance you could try with the 2.6 SNAPSHOT (either build trunk 
yourself or wait till tomorrow for the snaps to deploy) and see how it works 
for you?

One note: I *think* I found a bug in the jaxb-impl that is causing my test 
to fail if assertions are enabled on the JVM and you aren't using CXF.  
Bouncing through the DOM is doing something funny with the namespace 
prefixes or something.  I need to dig into that a bit more.   However, if 
you use CXF as the jax-ws implementation or you don't enable the assertions, 
you should be all set.  

Dan



> 
> 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-th
> rough-NotificationBroker-tp5596534p5596534.html Sent from the cxf-dev
> mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Mime
View raw message