Guillaume thanks for your answer.

I'm tying to use the client API but I can't find so much docs about it even if javadoc. Do you have anything about it?

Leandro


Guillaume Nodet wrote:
If you are inside the JBI bus, I would advise you to use the client API
for the WS-Notication component, or to use the lightweight proxy to
publish messages and use a SU to register a consumer.

If you are inside the JBI bus, as it seems, i would use my favorite soap
stack to generate java using wsdl->java, and then just use the generated
classes as explained in the WS-Notification specification.
The key point is that the address of the subscriber is expressed using a URI
as explained at:
    http://incubator.apache.org/servicemix/uris.html

So if your subscriber is external to the JBI bus, you need to give the url
to your service
instead of
 consumer.getAddress().setValue("
http://servicemix.org/wsnotification/NotificationBroker/http-binding";);

Also, if you have not already done so, increase the log level to DEBUG to
see what happens when you
send a notification.

On 5/24/07, Leandro Sales <[EMAIL PROTECTED]> wrote:

HI,

   I'm trying to use wsn2005 but i'm not finding any docs to help me on
it. After hard work I could create a NotificationBroeker and Subscribe
to a topic  but I can't discover how to send/receive notification
to/from this topic. This code above is what i've done... Canybody can
help me on my next steps?

Thanx anyway,

Leandro

try{

            URL url = new URL("http://localhost:8192/Broker/main.wsdl";);

            Service s = Service.create(url,new
QName("http://servicemix.org/wsnotification","NotificationBroker";));
            NotificationBroker nb = s.getPort(new
QName("http://servicemix.org/wsnotification","http-binding";),
NotificationBroker.class);


            //Subscribe
            SubscribeFactoryBean subscribeFactoryBean = new
SubscribeFactoryBean();
            subscribeFactoryBean.setTopic("meuTopico");
            Subscribe subscribe =
(Subscribe)subscribeFactoryBean.getObject();
EndpointReferenceType consumer = new EndpointReferenceType();

            consumer.setAddress(new AttributedURIType());

consumer.getAddress().setValue("
http://servicemix.org/wsnotification/NotificationBroker/http-binding";);
            subscribe.setConsumerReference(consumer);
SubscribeResponse subscribeResponse = nb.subscribe(subscribe);


            //Register Publisher
            /*RegisterPublisherFactoryBean registerPublisherFactoryBean
= new RegisterPublisherFactoryBean();
            registerPublisherFactoryBean.setTopic("meuTopico");
            RegisterPublisher rp =
(RegisterPublisher)registerPublisherFactoryBean.getObject();

            EndpointReferenceType registerPublisherEndpoint = new
EndpointReferenceType();
registerPublisherEndpoint.setAddress(new AttributedURIType());

registerPublisherEndpoint.getAddress().setValue("
http://servicemix.org/wsnotification/NotificationBroker/http-binding";);

            rp.setPublisherReference(registerPublisherEndpoint);
            RegisterPublisherResponse registerPublisherResponse =
nb.registerPublisher(rp);*/




System.out.println(subscribeResponse.getSubscriptionReference
().getClass().getName());




            //Notify
            Notify notify = new Notify();

            nb.notify(notify);


        }
        catch(Exception ex){
            ex.printStackTrace();
        }





Reply via email to