Hi All,

Is there anybody who could help me out defining a complex type as the notification topic?

I was playing with the Math_notif example. Here is the wsdl to remind you:

   <xsd:element name="Value" type="xsd:int"/>
   <xsd:element name="LastOp" type="xsd:string"/>

   <xsd:element name="MathResourceProperties">
   <xsd:complexType>
       <xsd:sequence>
           <xsd:element ref="tns:Value" minOccurs="1" maxOccurs="1"/>
           <xsd:element ref="tns:LastOp" minOccurs="1" maxOccurs="1"/>
       </xsd:sequence>
   </xsd:complexType>
   </xsd:element>

What I would like to do is that to define a topic by using MathResourceProperties, and whenever a change happens in either on Value or LastOp to get notified and a complex type to be delivered to my listener.

I modified the MathService as below and in the listener program (ValueListener.java), I subscribe as:

topicExpression.setValue(MathQNames.RESOURCE_PROPERTIES);

When I run the client program to add something to Value, I don't get any notification. Note that, the service is working fine. I tried several things but couldn't make the notification running. I would really appreciate any help.

Best Regards
Fuat


From the MathQNames.java file:
----------------------------------------------------------------------------------------------------------------
   public static final QName RP_VALUE = new QName(NS, "Value");
   public static final QName RP_LASTOP = new QName(NS, "LastOp");
public static final QName RESOURCE_PROPERTIES = new QName(NS, "MathResourceProperties");


Modified MathService.java file:
-----------------------------------------------------------------------------------------------------------------
public class MathService implements Resource, ResourceProperties,
       TopicListAccessor {

   /* Resource Property set */
   private ResourcePropertySet propSet;

   /* Resource properties */
   private ResourceProperty valueRP;

   private ResourceProperty lastOpRP;

   private ResourceProperty mathResourcePropertiesRP;
/* Topic list */
   private TopicList topicList;

   Category log = Category.getInstance(MathService.class.getName());

   /* Constructor. Initializes RPs and topic */
   public MathService() throws RemoteException {
/* Create RP set */
       this.propSet = new SimpleResourcePropertySet(
               MathQNames.RESOURCE_PROPERTIES);

       /* Initialize the RP's */
       try {
           valueRP = new SimpleResourceProperty(MathQNames.RP_VALUE);
           valueRP.add(new Integer(0));

           lastOpRP = new SimpleResourceProperty(MathQNames.RP_LASTOP);
           lastOpRP.add("NONE");

       } catch (Exception e) {
           throw new RuntimeException(e.getMessage());
       }

       /* Configure the Topics */
       this.topicList = new SimpleTopicList(this);

mathResourcePropertiesRP = new SimpleResourceProperty(MathQNames.RESOURCE_PROPERTIES);

mathResourcePropertiesRP = new ResourcePropertyTopic(mathResourcePropertiesRP);

((ResourcePropertyTopic) mathResourcePropertiesRP).setSendOldValue(false);

       this.topicList.addTopic((Topic) mathResourcePropertiesRP);

       this.propSet.add(valueRP);
       this.propSet.add(lastOpRP);
       //this.propSet.add(mathResourcePropertiesRP);

   }



Reply via email to