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();
}