I registered the Math service (from Sotomayor tutorial) into IndexService
using the mds-servicegroup-add command.
The registration was successful and the "math:Value" resource property (of
the Math service) appears in the AggregatorData
element of the IndexService's Entry resource property.I want to receive the
notification from the IndexService even though the
math:Value in the IndexService's Entry has changed (observed using
wsrf-query).
I implement this class:
package org.globus.examples.clients.MathService_instance_notif;
import java.util.List;
import javax.xml.namespace.QName;
import org.apache.axis.message.addressing.Address;
import org.apache.axis.message.addressing.EndpointReferenceType;
import org.globus.wsrf.NotificationConsumerManager;
import org.globus.wsrf.NotifyCallback;
import org.globus.wsrf.WSNConstants;
import
org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType
;
import org.oasis.wsn.NotificationProducer;
import org.oasis.wsn.Subscribe;
import org.oasis.wsn.TopicExpressionTy pe;
import org.oasis.wsn.WSBaseNotificationServiceAddressingLocator;
import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType
;
public class ListenerClient implements NotifyCallback {
String NS = "
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd
";;
//String NS = "http://www.aist.go.jp/namespaces/wsrf/MathService";;
/* This method is called when a notification is delivered */
public void deliver(List topicPath, EndpointReferenceType producer,
Object message) {
System.out.println("Notification arrived");
ResourcePropertyValueChangeNotificationElementType notif_elem;
ResourcePropertyValueChangeNotificationType notif;
notif_elem = (ResourcePropertyValueChangeNotificationElementType)
message;
notif = notif_elem.getResourcePropertyValueChangeNotification();
if (notif != null) {
System.out.println("A notification has been delivered: ");
//System.out.print("Old value: ");
//System.out.println(notif.getOldValue
().get_any()[0].getValue());
System.out.print("New value: ");
System.out.println(notif.getNewValue().get_any()[0].getValue());
}
}
public void run(String serviceURI) {
try {
// The NotificationConsumerManager sets up an endpoint where
// notifications will be delivered.
System.out.println("Listen to: " + serviceURI);
NotificationConsumerManager consumer;
consumer = NotificationConsumerManager.getInstance();
consumer.startListening();
EndpointReferenceType consumerEPR = consumer
.createNotificationConsumer(this);
System.out.println("*****************************************");
// Create the request to the remote Subscribe() call
Subscribe request = new Subscribe();
// Must the notification be delivered using the Notify
operation?
request.setUseNotify(Boolean.TRUE);
// Indicate what the client's EPR is
request.setConsumerReference(consumerEPR);
QName ENTRY_RP = new QName(NS, "Entry");
System.out.println("*****************************************");
// The TopicExpression specifies what topic we want to subscribe
to
TopicExpressionType topicExpression = new TopicExpressionType();
topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT);
topicExpression.setValue(ENTRY_RP);
request.setTopicExpression(topicExpression);
System.out.println("************************************"+ENTRY_RP );
// Get a reference to the NotificationProducer portType
WSBaseNotificationServiceAddressingLocator notifLocator =
new WSBaseNotificationServiceAddressingLocator();
EndpointReferenceType endpoint = new EndpointReferenceType();
System.out.println("////////////////////////////////////////");
endpoint.setAddress (new Address(serviceURI));
System.out.println("////////////////////////////////////////");
NotificationProducer producerPort = notifLocator
.getNotificationProducerPort(endpoint);
System.out.println("///////////////////////////////////////1");
// Start the ball rolling...
producerPort.subscribe(request);
System.out.println("////////////////////////////////////////2");
// Loop forever and print notifications.
System.out.println("Waiting for notification. Ctrl-C to
end...");
while (true) {
try {
Thread.sleep(30000);
} catch (Exception e) {
System.out.println("Interrupted while sleeping.");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
ListenerClient client = new ListenerClient();
String smp = "
http://192.168.2.100:8080/wsrf/services/DefaultIndexService";
client.run(smp);
}
}
but when i had this execption when i run ListenerClient.java
AxisFault
faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.generalException<http://schemas.xmlsoap.org/soap/envelope/%7DServer.generalException>
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
{}faultData:<ns1:Timestamp xmlns:ns1="
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd
">2008-02-26T21:43:15.138Z</
s1:Timestamp><ns2:Originator xmlns:ns2="
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd"><ns1:Address
xmlns:ns1="http://s
hemas.xmlsoap.org/ws/2004/03/addressing">
http://192.168.2.100:8080/wsrf/services/DefaultIndexService</ns1:Address><ns3:ReferenceProperties
xmlns:ns3=
http://schemas.xmlsoap.org/ws/2004/03/addressing"/><ns4:ReferenceParameters
xmlns:ns4="http://schemas.xmlsoap.org/ws/2004/03/addressing"/></ns2:Origi
ator><ns3:Description xmlns:ns3="
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd">Notification
producer WS-Resource does
ot implement the correct java interface</ns3:Description><ns4:FaultCause
xmlns:ns4="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-dr
ft-01.xsd"><ns4:Timestamp>2008-02-26T21:43:15.138Z</ns4:Timestamp><ns4:ErrorCode
dialect="http://www.globus.org/fault/stacktrace">
at org.globus.wsrf.impl.notification.SubscribeHelper.subscribe(
SubscribeHelper.java:228)
at org.globus.wsrf.impl.notification.SubscribeProvider.subscribe(
SubscribeProvider.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:585)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(
RPCProvider.java:384)
at org.globus.axis.providers.RPCProvider.invokeMethodSub(
RPCProvider.java:104)
at org.globus.axis.providers.RPCProvider.invokeMethod(
RPCProvider.java:87)
at org.apache.axis.providers.java.RPCProvider.processMessage(
RPCProvider.java:281)
at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:319)
at org.apache.axis.strategies.InvocationStrategy.visit(
InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:450)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java :285)
at org.globus.wsrf.container.ServiceThread.doPost(ServiceThread.java
:662)
at org.globus.wsrf.container.ServiceThread.process(
ServiceThread.java:393)
at org.globus.wsrf.container.ServiceThread.run (ServiceThread.java
:297)
</ns4:ErrorCode><ns4:Description>org.oasis.wsn.TopicNotSupportedFaultType
</ns4:Description></ns4:FaultCause>
{
http://xml.apache.org/axis/}exceptionName:org.oasis.wsn.TopicNotSupportedFaultType<http://xml.apache.org/axis/%7DexceptionName:org.oasis.wsn.TopicNotSupportedFaultType>
{http://xml.apache.org/axis/}hostname:PC-de-user<http://xml.apache.org/axis/%7Dhostname:PC-de-user>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.axis.message.SOAPFaultBuilder.createFault(
SOAPFaultBuilder.java:181)
at org.apache.axis.message .SOAPFaultBuilder.endElement(
SOAPFaultBuilder.java:128)
at org.apache.axis.encoding.DeserializationContext.endElement(
DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse (Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(
DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at
org.apache.axis.message.addressing.handler.AddressingHandler.processClientResponse
(AddressingHandler.java:305)
at
org.apache.axis.message.addressing.handler.AddressingHandler.invoke(
AddressingHandler.java:110)
at org.apache.axis.strategies.InvocationStrategy.visit(
InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:190)
at org.apache.axis.client.Call.invokeEngine(Call.java:2726)
at org.apache.axis.client.Call.invoke(Call.java:2709)
at org.apache.axis.client.Call .invoke(Call.java:2385)
at org.apache.axis.client.Call.invoke(Call.java:2308)
at org.apache.axis.client.Call.invoke(Call.java:1765)
at org.oasis.wsn.NotificationProducerSOAPBindingStub.subscribe(
NotificationProducerSOAPBindingStub.java:707)
at
org.globus.examples.clients.MathService_instance_notif.ListenerClient.run(
ListenerClient.java:94)
at
org.globus.examples.clients.MathService_instance_notif.ListenerClient.main(
ListenerClient.java:116)
Please any help it is very important for me
Many Thanks