Thanks for your prompt reply Mr. Madsen

The below approach does not fit me as I modified the MyCapability.java as
given below:

//
    // MyCapability.java
    // Tue Apr 22 16:45:01 EEST 2008
    // Generated by the Apache Muse Code Generation Tool
    //
    package org.apache.ws.muse.test.wsrf;

    import javax.xml.namespace.QName;

    import org.w3c.dom.Element;

    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 MyCapability extends AbstractWsResourceCapability
implements IMyCapability
    {
        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;
        }

    // You can assign any value you may want to the two variables below.
        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()
                {
                    //
                    // 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();
        }
    }

    It is almost identical to the source code given with muse.

On Mon, Apr 28, 2008 at 12:43 PM, Lenni Madsen <[EMAIL PROTECTED]> wrote:

> A thing just occurred to me, the people affected by this issue seems to
> follow the following approach (please correct me when/if I'm wrong, I'll
> assume this is correctly understood until further notice):
>
>
>
> 1)       wsdl2java is called on one or more wsdl's from the sample-wsn
> project
>
> 2)       no code is edited after wsdl2java is called (no files are copied
> to
> the project after wsdl2java is called either)
>
> 3)       the war file is deployed
>
> 4)       the project experiences one or more errors
>
>
>
> from my past experiences with the sample-wsn project and indeed any
> further
> development issues I have had with wsn, one needs to make sure that the
> generated code is edited to be up to spec, for one thing some important
> wsn-producer code is not put in the MyCapability.java (might have another
> name if you're using the more advance naming options) initialize function.
>
>
>
> *** what you get ***
>
> public void initialize() throws SoapFault
>
>    {
>
>        //
>
>        //The following call is necessary to property initialize the
> resource
>
>        //
>
>        super.initialize();
>
>
>
>        //
>
>        //TODO perform intitialization of the following non-primitive
> properties
>
>        //
>
>        // ServerName
>
>        //
>
>
>
>        throw new RuntimeException("User needs to update initialization
> code");
>
> }
>
>
>
> *** what you need for the sample-wsn ***
>
> public void initialize() throws SoapFault
>
>    {
>
>        //
>
>        //The following call is necessary to property initialize the
> resource
>
>        //
>
>        super.initialize();
>
>
>
>        //
>
>        //TODO perform intitialization of the following non-primitive
> properties
>
>        //
>
>        // ServerName
>
>        //
>
>
>
> //        throw new RuntimeException("User needs to update initialization
> code");
>
>        _ServerName = "sample-wsn-producer";
>
>        wsn =
>
> (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI)
> ;
>
>        // move this code below to a function if you wish to use it when
> called and not continuously
>
>        QName topicName = new QName("http://example.com/server-product";,
> "ServerUpdates");
>
>        wsn.addTopic(topicName);
>
>        QName messageName = new QName("http://example.com/server-product";,
> "UpdateMessage");
>
>        String updateMessage = "Something important happened!";
>
>        Element payload = XmlUtils.createElement(messageName,
> updateMessage);
>
>        wsn.publish(topicName, payload);
>
>    }
>
>
>
> Not sure if it helps at all, but at least it closes one possible issue
> related to starting up the application and initialization of the producer.
>
>
>
> Mr. Kanat, please don't worry about replying to the mail group message
> it's
> here for questions and debate regarding the use of the Muse framework and
> I
> find I learn new things every time I have a look at other peoples issues
> with Muse. sometimes a solution for a problems ends up enhancing my own
> projects.
>
>
>
> /Lenni
>
>  _____
>
> Fra: Irfan Emrah Kanat [mailto:[EMAIL PROTECTED]
> Sendt: 28. april 2008 10:56
> Til: [email protected]
> Emne: Re: trouble with WsnTestClient after new wsn-producer.war file
>
>
>
> I am not sure if this is the right way to reply to a mail group message
> but
> it is my first time so forgive me just this once.
>
> I set the binding in wsdl file as I stated earlier but here, I am
> attaching
> my wsdl file here.
>
> There is also another problem. I guess Mr. Nguyen is right as my app does
> not seem to be starting up. As I posted in my previous post, I build it as
> an axis2 app. but in tomcat manager I can not see the usual web interface
> of
> axis2. I get an HTTP Status 500 error. It seems to me that my app is not
> built correctly. The fact that I am getting a cygwin error alleviates my
> belief.
>
> Here is the command I issue and the error message I get:
>
> [EMAIL PROTECTED]:~/Desktop/samp$ sudo sh
> /opt/muse-2.2.0-bin/bin/wsdl2java.sh -j2ee axis2 -wsdl
> sample-wsn-producer.wsdl -output wsn-srv/ -overwrite
> [: 38: cygwin: unexpected operator
> [EMAIL PROTECTED]:~/Desktop/samp$
>
> If there is anything else I can provide please let me know...
>
>
>
>
>
>
>
> On Mon, Apr 28, 2008 at 9:08 AM, Lenni Madsen <[EMAIL PROTECTED]> wrote:
>
> Hi there
>
> Could you attach your wsdl file? It might be something fairly simple and
> therefore easy to overlook in the wsdl, I know I've missed small important
> stuff time and time again.
>
>
> [Fatal Error] :1:1040: The element type "HR" must be terminated by the
> > matching end-tag "</HR>".
> > org.apache.muse.ws.addressing.soap.SoapFault: The element type "HR"
> > must be terminated by the matching end-tag "</HR>".
>
> This error comes when you're trying to use a wrong or incomplete
> EndpointReference. The error message is very generic.
>
> /Lenni
>
>
> -----Oprindelig meddelelse-----
> Fra: dulbirakan [mailto:[EMAIL PROTECTED]
> Sendt: 27. april 2008 23:19
> Til: [email protected]
> Emne: Re: trouble with WsnTestClient after new wsn-producer.war file
>
>
>
> I had the same problem, infact I still have it.
>
> I used muse 2.2.0's wsdl2java in ubuntu linux (7.10 and 8.04) both to no
> avail but it worked under windows XP in my advisors computer.
>
> First I change the binding in sample-wsn-producer.wsdl to point to my
> producer (wsn-srv) then I change the source of wsn-consumers test class to
> point to my producer. Then I issue wsdl2java command and deploy services.
> I
> get the same error message you are getting (the one with HR). I also
> deployed one with default settings, it was a no go also.
>
> I issue:
>
> $ sudo sh /opt/muse-2.2.0-bin/bin/wsdl2java.sh -j2ee axis2 -wsdl
> sample-wsn-producer.wsdl -output wsn-srv/ -overwrite
>
> I get a :
> [: 38: cygwin: unexpected operator
>
> but everything seems to be in place and I run ant and copy the resulting
> war
> files to my tomcat webapps folder. These war files however, once deployed
> do
> not act as axis2 services. When I click on one in tomcat manager I see the
> following message instead of the usual axis2 web interface:
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
>
> exception
>
> org.apache.jasper.JasperException: java.lang.NullPointerException
>
>
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWra
> pper.java:522)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
> 56)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
> 68)
>
> org.apache.jsp.axis2_002dweb.index_jsp._jspService(index_jsp.java:78)
>       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
> 74)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> root cause
>
> java.lang.NullPointerException
>
>
> org.apache.jsp.axis2_002dweb.include.httpbase_jsp.jspInit(httpbase_jsp.java:
> 22)
>       org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:51)
>
>
> org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.jav
> a:159)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
> 29)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
> 68)
>
> org.apache.jsp.axis2_002dweb.index_jsp._jspService(index_jsp.java:78)
>       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
> 74)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> note The full stack trace of the root cause is available in the Apache
> Tomcat/6.0.16 logs.
> Apache Tomcat/6.0.16
>
>
> I really would appreciate if it would just run under ubuntu.
>
> I guess the problem might be related to the cygwin problem I stated
> earlier.
> Does any one have any clue?
>
>
> dchou wrote:
> >
> > Hello,
> >
> > I am able to drop the sample wsn-producer.war and wsn-consumer.war files
> > into my Tomcat and they run fine when I run the WsnTestClient. However,
> > when I do a wsdl2java build in the wsn-producer directory then build a
> new
> > war using Ant. I get an error message with this newly created
> > wsn-producer.war. I have changed no code. Only performed wsdl2java and
> > ant. The steps and error I get when I run the WsnTestClient is as
> follows:
> >
> > $wsdl2java -j2ee axis2 -overwrite -wsdl wsdl/WsResource.wsdl
> >
> > $ ant-1.6.5/bin/ant
> >
> > I then run the test client, WsnTestClient and get the following output:
> >
> > [CLIENT TRACE] SOAP envelope contents (outgoing):
> >
> > <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://166.21.9.161:8080/ws
> <http://166.21.9.161:8080/wsn-producer/services/WsResource>
> n-producer/services/WsResource</wsa:To>
> >         <wsa:Action
> >
> xmlns:wsa="http://www.w3.org/2005/08/addressing";>
> http://docs.oasis-open.org/
> <http://docs.oasis-open.org/wsn/bw-2/NotificationProducer/SubscribeRequest
> >
> wsn/bw-2/NotificationProducer/SubscribeRequest</wsa:Action>
> >         <wsa:MessageID
> >
> xmlns:wsa="http://www.w3.org/2005/08/addressing
> ">uuid:f6255f7a-9b73-1057-462
> 0-a4ec2be5ff0a</wsa:MessageID>
> >         <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing";>
> >
> >
> <wsa:Address>http://www.w3.org/2005/08/addressing/role/anonymous
> </wsa:Addres
> s>
> >         </wsa:From>
> >     </soap:Header>
> >     <soap:Body>
> >         <wsnt:Subscribe xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2";>
> >             <wsnt:ConsumerReference>
> >                 <wsa:Address
> >
> xmlns:wsa="http://www.w3.org/2005/08/addressing";>
> http://166.21.9.175:8060/ws
> <http://166.21.9.175:8060/wsn-consumer/services/consumer>
> n-consumer/services/consumer</wsa:Address>
> >             </wsnt:ConsumerReference>
> >         </wsnt:Subscribe>
> >     </soap:Body>
> > </soap:Envelope>
> >
> > [Fatal Error] :1:1040: The element type "HR" must be terminated by the
> > matching end-tag "</HR>".
> > org.apache.muse.ws.addressing.soap.SoapFault: The element type "HR" must
> > be terminated by the matching end-tag "</HR>".
> >         at
> >
>
> org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.ja
> va:298)
> >         at
> >
>
> org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.ja
> va:254)
> >         at
> >
>
> org.apache.muse.ws.notification.remote.NotificationProducerClient.subscribe(
> NotificationProducerClient.java:97)
> >         at org.apache.muse.test.wsn.WsnTestClient.main(Unknown Source)
> >
> > Does anyone have any idea what I am doing wrong? I have changed no code.
> I
> > just wanted to try and build a new war with the method outlined in the
> > tutorial. Any help would be appreciated.
> >
> > Thanks,
> > Dave
> >
>
> --
> View this message in context:
>
> http://www.nabble.com/trouble-with-WsnTestClient-after-new-wsn-producer.war-
> <
> http://www.nabble.com/trouble-with-WsnTestClient-after-new-wsn-producer.war
> -file-tp10191599p16928534.html<http://www.nabble.com/trouble-with-WsnTestClient-after-new-wsn-producer.war-file-tp10191599p16928534.html>
> >
> file-tp10191599p16928534.html
> Sent from the Muse User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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]
>
>
>
>

Reply via email to