Hi, I am using the following article to create Wef-events and sending them through my producer.
http://www.ibm.com/developerworks/autonomic/library/ac-museevent.html?S_TACT=105AGX09&S_CMP=EDU At the producer side I create the Event using following code : ---------------------------------------------------------------------------------------------- Identity identity = (Identity) getResource().getCapability(MuwsConstants. IDENTITY_URI); WefFactory factory = new SimpleWefFactory(); ManagementEvent event = factory.createEvent(); //Create source component Component source = factory.createComponent(); source.setName(WefConstants.SOURCE_COMP_QNAME); EndpointReference epr = getResource().getEndpointReference(); Element eprXml = epr.toXML(); ComponentAddress sourceAddress = factory.createComponentAddress(); sourceAddress.addExtendedElement(eprXml); source.setAddress(sourceAddress); source.setResourceID(identity.getResourceId()); event.setSource(source); producer.publish(STOP_TOPIC_QNAME, event); ------------------------------------------------------------------------------------------ When the event get published I can see the following SOAP Message going out, which is proper message. ------------------------------------------------------------------------------------------ <wsnt:Message> <muws1:ManagementEvent xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd" ReportTime="2007-07-26T14:15:04+05:30"> <muws1:EventId>uuid:eeba976e-f7e5-d0dd-19c8-1bfd60363ae1</muws1:EventId> <muws1:SourceComponent> <muws1:ComponentAddress> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"/> <wsa:Address>http://9.182.81.239:8080/Database/services/DB</wsa:Address> </wsa:EndpointReference> </muws1:ComponentAddress> <muws1:ResourceId>uuid:3962ca13-d6b6-fa4f-a8bc-8e85ed67e3e2</muws1:ResourceId> </muws1:SourceComponent> </muws1:ManagementEvent> </wsnt:Message> ------------------------------------------------------------------------------------------ At the consumer side I had written the following code to receive my events and print it out. ------------------------------------------------------------------------------------------ public void process(NotificationMessage message) throws SoapFault { WefFactory factory = new SimpleWefFactory(); Iterator i = message.getMessageContentNames().iterator(); while (i.hasNext()) { QName payloadName = (QName)i.next(); Element payload = message.getMessageContent(payloadName); ManagementEvent event = factory.createEvent(payload); System.out.println(event); } } } ------------------------------------------------------------------------------------------ When the consumer receives the wef event and print it out on the console, it comes like the following ------------------------------------------------------------------------------------------ <muws1:ManagementEvent xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd" ReportTime="2007-07-26T14:15:04+05:30"> <muws1:EventId>uuid:eeba976e-f7e5-d0dd-19c8-1bfd60363ae1</muws1:EventId> <muws1:SourceComponent> <muws1:ComponentAddress> <muws1:ComponentAddress> <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:ReferenceParameters xmlns:wsa="http://www.w3.org/2005/08/addressing"/> <wsa:Address>http://9.182.81.239:8080/Database/services/DB</wsa:Address> </wsa:EndpointReference> </muws1:ComponentAddress> </muws1:ComponentAddress> </muws1:SourceComponent> </muws1:ManagementEvent> ------------------------------------------------------------------------------------------ <muws1:ComponentAddress> element appears twice in the output. Any idea about why it is appearing twice. If I just change the code at the consumer side to print the received NotificationMesssage as it is, QName payloadName = (QName)i.next(); Element payload = message.getMessageContent(payloadName); System.out.println(XmlUtils.toString(payload)); It prints the proper message. thanks With best regards, Saurabh Dravid, Staff Software Engineer - Autonomic Computing, India Software Lab, IBM Software Group Embassy Golf Links, 'B' Block, 4th Floor, Bangalore Phone: +91-80-51055494, e-mail: [EMAIL PROTECTED] About India Software Lab
