Mmm... that a tough question cause I refactored the examples to Maven based build, but... I reproduced the issue in the original samples, see attached the modified/added files. For completeness I also created a zip file containing both sample projects, this can be downloaded at http://gerodt.homeip.net/wsn-samples.zip (this file is ~45M, but the attached files should enable you to reproduce it).

Changed in wsn-consumer:
  • Added 'run' target in build.xml
Changed in wsn-producer:
  • Added file 'troubleTicketCreateEvent.xml' to root dir of the wsn-producer project (next to build.xml etc)
  • Added copy step to to build.xml include 'troubleTicketCreateEvent.xml' in WEB-INF/classes
  • Changed the run() method in src/org/apache/ws/muse/test/wsrf/MyCapabilityImpl.java to include the contents of 'troubleTicketCreateEvent.xml' in the notify message (and added imports)
Build and deploy both wars (I used tomcat) and then do a 'ant run' for the wsn-consumer.

If you take the original wsn-producer.war file you will see 'INFO: Received message:... ' messages in the catalina.out file of Tomcat.
The messages are logged by the ConsumerCapabilityImpl class of the wsn-consumer.

Once you deploy the modified wsn-producer that sends the contents of the 'troubleTicketCreateEvent.xml' as notification, the 'INFO: Received message:... ' messages will no longer be logged and the accept() and process() messages in the consumer are no longer being invoked.

Thanks for looking into it.

Regards,
Gero

Daniel Jemiolo wrote:
Can you send us the files that you changed? Or the new code, if you only 
changed Java? I will try to recreate your steps and see what happens. Make 
sure you document *every* file change.  :)

Dan



Gero Vermaas <[EMAIL PROTECTED]> wrote on 10/17/2006 02:39:32 PM:

  
Hi,

I'm using the wsn-consumer and wsn-producer examples as the basis to get 
    

  
some experience with Muse. I made some changes to it and now I run into 
a situation that I've been banging my head against for a couple of hours 
    

  
without seeing the light... Hope someone can point me in the right 
direction ;-)

If I let the wsn-producer sent out the following  message, it is 
correctly received in the wsn-consumer, the initializeCompleted(), 
accept() and process() messages are being invoked correctly. No problem. 
    

  
Note that I did change the tns namespace to reflect my situation.  This 
message still has the original content for the wsnt:Message element.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
        <wsa:To 

    
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/ossj-
  
tck-wsn-consumer/services/consumer</wsa:To>
        <wsa:Action 
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.
org/wsn/bw-2/NotificationConsumer/NotifyRequest</wsa:Action>
        <wsa:MessageID 

    
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:e80685de-459f-c18d-
  
a968-47c87f5dc36d</wsa:MessageID>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
            <wsa:ReferenceParameters 
xmlns:wsa="http://www.w3.org/2005/08/addressing"/>

<wsa:Address>http://127.0.0.1:8080/ossj-tck-fdtn-wsn-
producer/services/WsResource</wsa:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <wsnt:Notify xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
            <wsnt:NotificationMessage
                xmlns:muse-wsa="http://ws.apache.org/muse/addressing"
                xmlns:tns="http://org.ossj/tck/wsn/testproducer"
                xmlns:wsa="http://www.w3.org/2005/08/addressing" 
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
                <wsnt:SubscriptionReference>
                    <wsa:Address 

    
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://127.0.0.1:8080/ossj-
  
tck-fdtn-wsn-producer/services/SubscriptionManager</wsa:Address>
                    <wsa:ReferenceParameters 
xmlns:wsa="http://www.w3.org/2005/08/addressing">
                        <muse-wsa:ResourceId 

    
xmlns:muse-wsa="http://ws.apache.org/muse/addressing">MuseResource-1</muse-
  
wsa:ResourceId>
                    </wsa:ReferenceParameters>
                </wsnt:SubscriptionReference>
                <wsnt:Topic

Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete" 

    
xmlns:tns="http://org.ossj/tck/wsn/testproducer">tns:MyTopic</wsnt:Topic>
  
                <wsnt:ProducerReference>
                    <wsa:ReferenceParameters 
xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
                    <wsa:Address 

    
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://127.0.0.1:8080/ossj-
  
tck-fdtn-wsn-producer/services/WsResource</wsa:Address>
                </wsnt:ProducerReference>
                <wsnt:Message>
                    <tns:MyMessage 
xmlns:tns="http://org.ossj/tck/wsn/testproducer"/>
                </wsnt:Message>
            </wsnt:NotificationMessage>
        </wsnt:Notify>
    </soap:Body>
</soap:Envelope>


Now when I modify the producer  to sent the following message, in the 
wsn-consumer only the initializeCompleted() method gets invoked when the 
    

  
message is received. accept() and process() are not invoked, so it looks 
    

  
like the message is rejected for some reason, but I don't get any 
logging output to the console. (just that initializeCompleted() in 
invoked, no errors).  The "only" change compared to the previous message 
    

  
is that the contents of the wsnt:Message is now an XML snippet that I 
would like to sent as a notification.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
        <wsa:To 

    
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8081/ossj-
  
tck-wsn-consumer/services/consumer</wsa:To>
        <wsa:Action 
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.
org/wsn/bw-2/NotificationConsumer/NotifyRequest</wsa:Action>
        <wsa:MessageID 
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:
02161d65-3418-96cf-5bee-063b78494ff1</wsa:MessageID>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
            <wsa:ReferenceParameters 
xmlns:wsa="http://www.w3.org/2005/08/addressing"/>

<wsa:Address>http://127.0.0.1:8080/ossj-tck-fdtn-wsn-
producer/services/WsResource</wsa:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <wsnt:Notify xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
            <wsnt:NotificationMessage xmlns:=""
                xmlns:muse-wsa="http://ws.apache.org/muse/addressing"
                xmlns:wsa="http://www.w3.org/2005/08/addressing" 
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
                <wsnt:SubscriptionReference>
                    <wsa:Address 

    
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://127.0.0.1:8080/ossj-
  
tck-fdtn-wsn-producer/services/SubscriptionManager</wsa:Address>
                    <wsa:ReferenceParameters 
xmlns:wsa="http://www.w3.org/2005/08/addressing">
                        <muse-wsa:ResourceId 

    
xmlns:muse-wsa="http://ws.apache.org/muse/addressing">MuseResource-1</muse-
  
wsa:ResourceId>
                    </wsa:ReferenceParameters>
                </wsnt:SubscriptionReference>
                <wsnt:Topic

Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete" 

    
xmlns:tns="http://org.ossj/tck/wsn/testproducer">tns:MyTopic</wsnt:Topic>
  
                <wsnt:ProducerReference>
                    <wsa:ReferenceParameters 
xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
                    <wsa:Address 

    
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://127.0.0.1:8080/ossj-
  
tck-fdtn-wsn-producer/services/WsResource</wsa:Address>
                </wsnt:ProducerReference>
                <wsnt:Message>
                    <tt:troubleTicketCreateEvent

xmlns:co="http://java.sun.com/products/oss/xml/Common"


    
xmlns:fm="http://java.sun.com/products/oss/xml/QualityOfService/FM/Monitor"
  
    
xmlns:measurement="http://java.sun.com/products/oss/xml/QualityOfService/PM/Measurement"
  
    
xmlns:threshold="http://java.sun.com/products/oss/xml/QualityOfService/PM/Threshold"
  
xmlns:tt="http://java.sun.com/products/oss/xml/TroubleTicket"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.
com/products/oss/xml/TroubleTicket/XmlTroubleTicketSchema.xsd">
                        <tt:event>


    
<co:applicationDN>System/RI/ApplicationType/TroubleTicket/Application/1-0;
  
1-0-2;OSSJTTRI</co:applicationDN>

<co:eventTime>2006-06-05T06:16:46Z</co:eventTime>
                            <tt:troubleTicketValue>

<co:lastUpdateVersionNumber>0</co:lastUpdateVersionNumber>
                                <tt:troubleTicketKey>
                                    <co:applicationContext>

<co:factoryClass>com.sun.jndi.cosnaming.CNCtxFactory</co:factoryClass>
<co:url>"iiop://127.0.0.1:3700"</co:url>
                                    <co:systemProperties/>
                                    </co:applicationContext>


    
<co:applicationDN>System/RI/ApplicationType/TroubleTicket/Application/1-0;
  
1-0-2;OSSJTTRI</co:applicationDN>
<co:type>tt:TroubleTicketValue</co:type>

<tt:primaryKey>1149524206107</tt:primaryKey>
                                </tt:troubleTicketKey>
                            </tt:troubleTicketValue>
                        </tt:event>
                    </tt:troubleTicketCreateEvent>
                </wsnt:Message>
            </wsnt:NotificationMessage>
        </wsnt:Notify>
    </soap:Body>
</soap:Envelope>

Is there a reason why the message is not handed over to the accept() and 
    

  
process() methods in the wsn-consumer? Is the contents of the last 
message wsnt:Message element violating some rules?

Thanks,
Gero

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

    


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  
<?xml version="1.0"?>
<project name="project" default="war">
    <target name="init">
        <basename property="NAME" file="${basedir}"/>
        <property name="MUSE_HOME" value="../.."/>
        <property name="MUSE_TEMPLATE" value="${MUSE_HOME}/lib/axis2"/>
        <property name="BUILD_DIR" value="build"/>
        <property name="JAVA_SRC_DIR" value="src"/>
        <property name="JAVA_DEST_DIR" value="${BUILD_DIR}/bin"/>
        
        <property name="WAR_FILE" value="${BUILD_DIR}/${NAME}.war"/>
        <property name="LIB_DIR" value="${BUILD_DIR}/WEB-INF/lib"/>
        <property name="JAR_FILE" value="${LIB_DIR}/${NAME}.jar"/>

        <path id="muse.class.path">
            <fileset dir="${MUSE_HOME}/modules/ws-fx-api/">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${MUSE_HOME}/modules/ws-fx-impl/">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${MUSE_HOME}/modules/core/">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${MUSE_TEMPLATE}/WEB-INF/lib">
                <include name="wsdl4j*.jar"/>
            </fileset>
        </path>
    </target>

    <target name="layout" depends="init, clean">
        <copy todir="${BUILD_DIR}">
            <fileset dir="${MUSE_TEMPLATE}">
                <include name="**/*"/>
            </fileset>
        </copy>

        <copy todir="${BUILD_DIR}/WEB-INF/services/muse/">
            <fileset dir=".">
                <include name="wsdl/**"/>
                <include name="router-entries/**"/>
            </fileset>
        </copy>
        
        <copy todir="${BUILD_DIR}/WEB-INF/services/muse/META-INF">
            <fileset dir="config">
                <include name="services.xml"/>
            </fileset>
        </copy>

        <copy todir="${BUILD_DIR}/WEB-INF/services/muse">
            <fileset dir="config">
                <include name="muse.xml"/>
            </fileset>
        </copy>

		<copy todir="${LIB_DIR}" flatten="true">
			<fileset dir="${MUSE_HOME}/modules">
				<include name="ws-fx-api/*.jar"/>
				<include name="axis2/*.jar"/>
				<include name="ws-fx-impl/*.jar"/>
				<include name="core/*.jar"/>
			</fileset>
        </copy>
    </target>
    
	<target name="java" depends="layout">
		<mkdir dir="${JAVA_DEST_DIR}"/>
		<javac srcdir="${JAVA_SRC_DIR}" destdir="${JAVA_DEST_DIR}" classpathref="muse.class.path"/>
		<jar basedir="${JAVA_DEST_DIR}" destfile="${JAR_FILE}">
			<fileset dir="${JAVA_DEST_DIR}">
				<include name="**/*.class"/>
			</fileset>
		</jar>
	</target>

    <target name="war" depends="java">
		<jar destfile="${WAR_FILE}">
            <fileset dir="${BUILD_DIR}">
                <include name="WEB-INF/**"/>
			</fileset>
        </jar>
	</target>

	<target name="clean" depends="init">
        <delete dir="${BUILD_DIR}"/>		
	</target>

<target name="run">
         <java className="org.apache.muse.test.wsn.WsnTestClient">
                 <classpath>
                         <fileset dir="build/WEB-INF/lib">
                                 <include name="*.jar"/>
                         </fileset>
                 </classpath>
         </java>
 </target>
</project>

<?xml version="1.0"?>
<project name="project" default="war">
    <target name="init">
        <basename property="NAME" file="${basedir}"/>
        <property name="MUSE_HOME" value="../.."/>
        <property name="MUSE_TEMPLATE" value="${MUSE_HOME}/lib/axis2"/>
        <property name="BUILD_DIR" value="build"/>
        <property name="JAVA_SRC_DIR" value="src"/>
        <property name="JAVA_DEST_DIR" value="${BUILD_DIR}/bin"/>
        
        <property name="WAR_FILE" value="${BUILD_DIR}/${NAME}.war"/>
        <property name="LIB_DIR" value="${BUILD_DIR}/WEB-INF/lib"/>
        <property name="JAR_FILE" value="${LIB_DIR}/${NAME}.jar"/>

        <path id="muse.class.path">
            <fileset dir="${MUSE_HOME}/modules/ws-fx-api/">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${MUSE_HOME}/modules/ws-fx-impl/">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${MUSE_HOME}/modules/core/">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${MUSE_TEMPLATE}/WEB-INF/lib">
                <include name="wsdl4j*.jar"/>
            </fileset>
        </path>
    </target>

    <target name="layout" depends="init, clean">
        <copy todir="${BUILD_DIR}">
            <fileset dir="${MUSE_TEMPLATE}">
                <include name="**/*"/>
            </fileset>
        </copy>

        <copy todir="${BUILD_DIR}/WEB-INF/services/muse/">
            <fileset dir=".">
                <include name="wsdl/**"/>
                <include name="router-entries/**"/>
            </fileset>
        </copy>
        
        <copy todir="${BUILD_DIR}/WEB-INF/services/muse/META-INF">
            <fileset dir="config">
                <include name="services.xml"/>
            </fileset>
        </copy>

        <copy todir="${BUILD_DIR}/WEB-INF/services/muse">
            <fileset dir="config">
                <include name="muse.xml"/>
            </fileset>
        </copy>

		<copy todir="${LIB_DIR}" flatten="true">
			<fileset dir="${MUSE_HOME}/modules">
				<include name="ws-fx-api/*.jar"/>
				<include name="axis2/*.jar"/>
				<include name="ws-fx-impl/*.jar"/>
				<include name="core/*.jar"/>
			</fileset>
        </copy>

        <!-- GV ADDED -->
<copy todir="${BUILD_DIR}/WEB-INF/classes" file="troubleTicketCreateEvent.xml"/>
        <!-- GV EO ADDED -->

    </target>
    
	<target name="java" depends="layout">
		<mkdir dir="${JAVA_DEST_DIR}"/>
		<javac srcdir="${JAVA_SRC_DIR}" destdir="${JAVA_DEST_DIR}" classpathref="muse.class.path"/>
		<jar basedir="${JAVA_DEST_DIR}" destfile="${JAR_FILE}">
			<fileset dir="${JAVA_DEST_DIR}">
				<include name="**/*.class"/>
			</fileset>
		</jar>
	</target>

    <target name="war" depends="java">
		<jar destfile="${WAR_FILE}">
            <fileset dir="${BUILD_DIR}">
                <include name="WEB-INF/**"/>
			</fileset>
        </jar>
	</target>

	<target name="clean" depends="init">
        <delete dir="${BUILD_DIR}"/>		
	</target>
</project>

<tt:troubleTicketCreateEvent
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  xmlns:tt="http://java.sun.com/products/oss/xml/TroubleTicket";
  xmlns:fm="http://java.sun.com/products/oss/xml/QualityOfService/FM/Monitor";
  xmlns:measurement="http://java.sun.com/products/oss/xml/QualityOfService/PM/Measurement";
  xmlns:threshold="http://java.sun.com/products/oss/xml/QualityOfService/PM/Threshold";
  xmlns:co="http://java.sun.com/products/oss/xml/Common";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://java.sun.com/products/oss/xml/TroubleTicket/XmlTroubleTicketSchema.xsd";>

  <tt:event>
    <co:applicationDN>System/RI/ApplicationType/TroubleTicket/Application/1-0;1-0-2;OSSJTTRI</co:applicationDN>
    <co:eventTime>2006-06-05T06:16:46Z</co:eventTime>
    <tt:troubleTicketValue>
      <co:lastUpdateVersionNumber>0</co:lastUpdateVersionNumber>

      <tt:troubleTicketKey>
        <co:applicationContext>
          <co:factoryClass>com.sun.jndi.cosnaming.CNCtxFactory</co:factoryClass>
          <co:url>"iiop://127.0.0.1:3700"</co:url>
          <co:systemProperties/>
        </co:applicationContext>
        <co:applicationDN>System/RI/ApplicationType/TroubleTicket/Application/1-0;1-0-2;OSSJTTRI</co:applicationDN>
        <co:type>tt:TroubleTicketValue</co:type>
        <tt:primaryKey>1149524206107</tt:primaryKey>
      </tt:troubleTicketKey>
    </tt:troubleTicketValue>
  </tt:event>
</tt:troubleTicketCreateEvent>
/*=============================================================================*
 *  Copyright 2006 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *=============================================================================*/

package org.apache.ws.muse.test.wsrf;

import javax.xml.namespace.QName;
import java.io.InputStream;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import java.io.InputStream;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.apache.muse.util.xml.XmlUtils;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.notification.NotificationProducer;
import org.apache.muse.ws.notification.WsnConstants;
import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;

public class MyCapabilityImpl extends AbstractWsResourceCapability implements MyCapability
{
    private static final QName[] _PROPERTIES = new QName[] {
            new QName(NAMESPACE_URI, "MessageInterval", PREFIX),
            new QName(NAMESPACE_URI, "ServerName", PREFIX) 
    };

    private static final QName _TOPIC_NAME = new QName(NAMESPACE_URI, "MyTopic", PREFIX);
    
    public QName[] getPropertyNames()
    {
        return _PROPERTIES;
    }

    private int _MessageInterval = 10;

    private String _ServerName = "muse-test.apache.org";

    public int getMessageInterval()
    {
        return _MessageInterval;
    }

    public void setMessageInterval(int param0)
    {
        _MessageInterval = param0;
    }

    public String getServerName()
    {
        return _ServerName;
    }

    public void setServerName(String param0)
    {
        _ServerName = param0;
    }
    
    public void initializeCompleted() 
        throws SoapFault
    {
        super.initializeCompleted();
        
        //
        // access resource's WSN capability and create a new topic
        //
        final NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI);
        wsn.addTopic(_TOPIC_NAME);

        Thread producer = new Thread() {

      public void run() {
        try {
          QName messageName = new QName(NAMESPACE_URI, "MyMessage", PREFIX);
          
          InputStream is = MyCapabilityImpl.class.
            getResourceAsStream("/troubleTicketCreateEvent.xml");
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();
          Document document = builder.parse(new InputSource(is));
          
          // read current value - property is mutable
          int currentInterval = getMessageInterval();
          
          getLog().info("Waiting " + currentInterval + " seconds before sending message...");
          Thread.currentThread().sleep(currentInterval * 1000);
          
          getLog().info("Sending message to consumers...");
          wsn.publish(_TOPIC_NAME, document.getDocumentElement());
        } catch(Throwable error) {
          error.printStackTrace();
        }
      }		
		/*
            public void run()
            {
                //
                // for this example, reuse one payload for every notification
                //
                QName messageName = new QName(NAMESPACE_URI, "MyMessage", PREFIX);
                String message = "This is a message from " + getServerName();
                Element payload = XmlUtils.createElement(messageName, message);
                
                while (true)
                {
                    try
                    {
                        //
                        // read current value - property is mutable
                        //
                        int currentInterval = getMessageInterval();
                        
                        getLog().info("Waiting " + currentInterval + " seconds before sending message...");
                        Thread.currentThread().sleep(currentInterval * 1000);
                        
                        //
                        // use WSN capability to send message to any subscribers
                        //
                        getLog().info("Sending message to consumers...");
                        wsn.publish(_TOPIC_NAME, payload);
                    }

                    catch (Throwable error)
                    {
                        error.printStackTrace();
                    }
                }
            }
	    */
        };
        producer.start();
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to