You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by ciel <37...@qq.com> on 2009/05/20 10:47:05 UTC

Transport my own data types form wsn-producer to wsn-consumer

Hello,sir,
I want to Transport my own data types  form wsn-producer to wsn-consumer,
such as follows:

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

class WsnTestDateType {
	WsnTestDateType (){};
	WsnTestDateType (int ID, String name){
		this.ID = ID;
		this.name = name;
	}
	public int getID() {
		return ID;
	}
	public void setID(int id) {
		ID = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		WsnTestDateType.name = name;
	}
	private static int ID;
	private static String name;
}
If I have done this

WsnTestDateType studentMessage = new WsnTestDateType (int ID, String
name)(int ID, String name);

How could I use wsn.publish(_TOPIC_NAME, payload) to set studentMessage to
wsn-consumer and receive it? Any examples?

Besides, if I replace WsnTestDateType  with a xml document as follows, how
should I do?

//stuService.xml
<?xml version="1.0" encoding="UTF-8"?>
<ns:stuInfo
xmlns:ns="http://localhost:8080/stuService.xsd"><ns:shipmentID>1</ns:shipmentID>
   <ns:stuID>25</ns:stuID>
   <ns:stuName>Joe</ns:stuName>
</ns:stuInfo>

//stuService.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://localhost:8080/stuService.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://localhost:8080/stuService.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:element name="stuInfo">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="stuID" type="xsd:int"/>
				<xsd:element name="stuName" type="xsd:string"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>

Thanks very much. I am looking forward to your reply.
-- 
View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23631392.html
Sent from the Muse User mailing list archive at Nabble.com.


Re: Transport my own data types from wsn-producer to wsn-consumer

Posted by Lenni Madsen <l....@mil.dk>.
sounds like one or more of your EndPointReferences are broken, I would  
suggest that you double check all your EPRs.

For references a broken HR fault means you're trying to invoke an  
endpoint, that does not exist.

On 21/05/2009, at 09.59, ciel <37...@qq.com> wrote:

>
> ok,thanks very much.
> when I indroduced your code in wsn-producer, it produced:
>
> *******************************************************
> 2009-5-21 15:27:50 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
> 信息: Sending message to consumers...
> [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://192.168.
> 6.251:8080/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:a6a
> c392c-e6b8-2cbc-895d-c04201eba23a</wsa:MessageID>
>        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
>            <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/08/addres
> sing"/>
>
> <wsa:Address>http://localhost:8080/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:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd 
> "
>                xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd 
> "
>                xmlns:wsa="http://www.w3.org/2005/08/addressing"
> xmlns:wsnt="htt
> p://docs.oasis-open.org/wsn/b-2">
>                <wsnt:SubscriptionReference>
>                    <wsa:Address
> xmlns:wsa="http://www.w3.org/2005/08/addressing
> ">http://localhost:8080/wsn-producer/services/SubscriptionManager</ 
> wsa:Address>
>                    <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/0
> 8/addressing">
>                        <muse-wsa:ResourceId
> xmlns:muse-wsa="http://ws.apache.or
> g/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://ws.apache.org/muse/test/wsrf">tns:MyTopic</wsnt:Topi
> c>
>                <wsnt:ProducerReference>
>                    <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/0
> 8/addressing"/>
>                    <wsa:Address
> xmlns:wsa="http://www.w3.org/2005/08/addressing
> ">http://localhost:8080/wsn-producer/services/WsResource</wsa:Address>
>                </wsnt:ProducerReference>
>                <wsnt:Message>
>                    <muws1:ManagementEvent
>
> xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd
> " ReportTime="2009-05-21T15:27:04+08:00">
>
> <muws1:EventId>uuid:ddeac1a5-5dcf-67fc-e17f-d71afce0fa5b
> </muws1:EventId>
>                        <muws1:SourceComponent>
>                            <muws1:ComponentAddress>
>                                <wsa:EndpointReference
> xmlns:wsa="http://www.w3.
> org/2005/08/addressing">
>                                    <wsa:ReferenceParameters
> xmlns:wsa="http://w
> ww.w3.org/2005/08/addressing"/>
>
> <wsa:Address>http://localhost:8080/wsn-produ
> cer/services/WsResource</wsa:Address>
>                                </wsa:EndpointReference>
>                            </muws1:ComponentAddress>
>                        </muws1:SourceComponent>
>                        <muws1:ReporterComponent>
>                            <muws1:ComponentAddress>
>                                <wsa:EndpointReference
> xmlns:wsa="http://www.w3.
> org/2005/08/addressing">
>                                    <wsa:ReferenceParameters
> xmlns:wsa="http://w
> ww.w3.org/2005/08/addressing"/>
>
> <wsa:Address>http://localhost:8080/wsn-produ
> cer/services/WsResource</wsa:Address>
>                                </wsa:EndpointReference>
>                            </muws1:ComponentAddress>
>                        </muws1:ReporterComponent>
>                        <muws2:Situation
> xmlns:muws2="http://docs.oasis-open.org
> /wsdm/muws2-2.xsd">
>                            <muws2:SituationCategory>
>                                <muws2:AvailabilitySituation/>
>                            </muws2:SituationCategory>
>
> <muws2:SituationTime>2009-05-21T15:27:04+08:00</muws
> 2:SituationTime>
>                            <muws2:Priority>70</muws2:Priority>
>                            <muws2:Message>Something important has  
> happened
> in t
> he muse-test.apache.org!</muws2:Message>
>                        </muws2:Situation>
>                        <shipmentCheckResultInfo
>
> xmlns="http://localhost:8080/ShipmentTrackService.xs
> d"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> " xsi:schemaLocation="http://localhost:8080/ShipmentTrackService.xsd
> ShipmentTra
>                        <muws1:ReporterComponent>
>                            <muws1:ComponentAddress>
>                                <wsa:EndpointReference
> xmlns:wsa="http://www.w3.
> org/2005/08/addressing">
>
> <wsa:Address>http://localhost:8080/wsn-produ
> cer/services/WsResource</wsa:Address>
>                                </wsa:EndpointReference>
>                            </muws1:ComponentAddress>
>                        </muws1:ReporterComponent>
>                        <muws2:Situation
> xmlns:muws2="http://docs.oasis-open.org
> /wsdm/muws2-2.xsd">
>                            <muws2:SituationCategory>
>                                <muws2:AvailabilitySituation/>
>                            </muws2:SituationCategory>
>
> <muws2:SituationTime>2009-05-21T15:27:04+08:00</muws
> 2:SituationTime>
>                            <muws2:Priority>70</muws2:Priority>
>                            <muws2:Message>Something important has  
> happened
> in t
> he muse-test.apache.org!</muws2:Message>
>                        </muws2:Situation>
>                        <shipmentCheckResultInfo
>
> xmlns="http://localhost:8080/ShipmentTrackService.xs
> d"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> " xsi:schemaLocation="http://localhost:8080/ShipmentTrackService.xsd
> ShipmentTra
> ckService.xsd">
>                            <shipmentID>123</shipmentID>
>                            <shipmentOwner>bincan</shipmentOwner>
>                            <shipmentCheckResult>true</ 
> shipmentCheckResult>
>                        </shipmentCheckResultInfo>
>                    </muws1:ManagementEvent>
>                </wsnt:Message>
>            </wsnt:NotificationMessage>
>        </wsnt:Notify>
>    </soap:Body>
> </soap:Envelope>
>
> [Fatal Error] :5:184: The element type "HR" must be terminated by the
> matching e
> nd-tag "</HR>".
> 2009-5-21 15:31:06 org.apache.muse.util.LoggingUtils logError
> 信息: There was an error while processing a request:
>
> The element type "HR" must be terminated by the matching end-tag "</ 
> HR>".
>
>
> org. 
> apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien
> t.java:298)
>
> org. 
> apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien
> t.java:254)
>
> org. 
> apache.muse.ws.notification.remote.NotificationConsumerClient.notify
> (NotificationConsumerClient.java:99)
>
> org. 
> apache.muse.ws.notification.impl.SimpleSubscriptionManager.publish(S
> impleSubscriptionManager.java:267)
>
> org. 
> apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
> SimpleNotificationProducer.java:445)
>
> org. 
> apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
> SimpleNotificationProducer.java:473)
>
> org. 
> apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
> SimpleNotificationProducer.java:462)
>        org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1.run(Unknown  
> Source)
>
> ------------------------------------------
>
> 2009-5-21 15:31:21
> org.apache.muse.ws.notification.impl.SimpleSubscriptionManage
> r publish
> 信息: [ID = 'LastPublishFailed'] The last notification published via
> wsnt:Notify
> failed to reach its destination. The consumer may be unavailable. The
> original
> error was: The element type "HR" must be terminated by the matching  
> end-tag
> "</H
> R>".
> 2009-5-21 15:31:21 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
> 信息: Waiting 10 seconds before sending message...
> ******************************************************************
>
> and at wsn-consumer, it produced
>
> *******************************************************************
> [Fatal Error] :14:45: Element or attribute do not match QName  
> production:
> QName:
> :=(NCName':')?NCName.
> *******************************************************************
>
> What should I do? Modify wsn-consumer's code? And if,
> -- 
> View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23649285.html
> Sent from the Muse User mailing list archive at Nabble.com.
>

Re: Transport my own data types from wsn-producer to wsn-consumer

Posted by Lenni Madsen <l....@mil.dk>.
just for references sake did you remember to subscribe the consumer to  
the producer?

On 21/05/2009, at 09.59, ciel <37...@qq.com> wrote:

>
> ok,thanks very much.
> when I indroduced your code in wsn-producer, it produced:
>
> *******************************************************
> 2009-5-21 15:27:50 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
> 信息: Sending message to consumers...
> [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://192.168.
> 6.251:8080/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:a6a
> c392c-e6b8-2cbc-895d-c04201eba23a</wsa:MessageID>
>        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
>            <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/08/addres
> sing"/>
>
> <wsa:Address>http://localhost:8080/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:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd 
> "
>                xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd 
> "
>                xmlns:wsa="http://www.w3.org/2005/08/addressing"
> xmlns:wsnt="htt
> p://docs.oasis-open.org/wsn/b-2">
>                <wsnt:SubscriptionReference>
>                    <wsa:Address
> xmlns:wsa="http://www.w3.org/2005/08/addressing
> ">http://localhost:8080/wsn-producer/services/SubscriptionManager</ 
> wsa:Address>
>                    <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/0
> 8/addressing">
>                        <muse-wsa:ResourceId
> xmlns:muse-wsa="http://ws.apache.or
> g/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://ws.apache.org/muse/test/wsrf">tns:MyTopic</wsnt:Topi
> c>
>                <wsnt:ProducerReference>
>                    <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/0
> 8/addressing"/>
>                    <wsa:Address
> xmlns:wsa="http://www.w3.org/2005/08/addressing
> ">http://localhost:8080/wsn-producer/services/WsResource</wsa:Address>
>                </wsnt:ProducerReference>
>                <wsnt:Message>
>                    <muws1:ManagementEvent
>
> xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd
> " ReportTime="2009-05-21T15:27:04+08:00">
>
> <muws1:EventId>uuid:ddeac1a5-5dcf-67fc-e17f-d71afce0fa5b
> </muws1:EventId>
>                        <muws1:SourceComponent>
>                            <muws1:ComponentAddress>
>                                <wsa:EndpointReference
> xmlns:wsa="http://www.w3.
> org/2005/08/addressing">
>                                    <wsa:ReferenceParameters
> xmlns:wsa="http://w
> ww.w3.org/2005/08/addressing"/>
>
> <wsa:Address>http://localhost:8080/wsn-produ
> cer/services/WsResource</wsa:Address>
>                                </wsa:EndpointReference>
>                            </muws1:ComponentAddress>
>                        </muws1:SourceComponent>
>                        <muws1:ReporterComponent>
>                            <muws1:ComponentAddress>
>                                <wsa:EndpointReference
> xmlns:wsa="http://www.w3.
> org/2005/08/addressing">
>                                    <wsa:ReferenceParameters
> xmlns:wsa="http://w
> ww.w3.org/2005/08/addressing"/>
>
> <wsa:Address>http://localhost:8080/wsn-produ
> cer/services/WsResource</wsa:Address>
>                                </wsa:EndpointReference>
>                            </muws1:ComponentAddress>
>                        </muws1:ReporterComponent>
>                        <muws2:Situation
> xmlns:muws2="http://docs.oasis-open.org
> /wsdm/muws2-2.xsd">
>                            <muws2:SituationCategory>
>                                <muws2:AvailabilitySituation/>
>                            </muws2:SituationCategory>
>
> <muws2:SituationTime>2009-05-21T15:27:04+08:00</muws
> 2:SituationTime>
>                            <muws2:Priority>70</muws2:Priority>
>                            <muws2:Message>Something important has  
> happened
> in t
> he muse-test.apache.org!</muws2:Message>
>                        </muws2:Situation>
>                        <shipmentCheckResultInfo
>
> xmlns="http://localhost:8080/ShipmentTrackService.xs
> d"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> " xsi:schemaLocation="http://localhost:8080/ShipmentTrackService.xsd
> ShipmentTra
>                        <muws1:ReporterComponent>
>                            <muws1:ComponentAddress>
>                                <wsa:EndpointReference
> xmlns:wsa="http://www.w3.
> org/2005/08/addressing">
>
> <wsa:Address>http://localhost:8080/wsn-produ
> cer/services/WsResource</wsa:Address>
>                                </wsa:EndpointReference>
>                            </muws1:ComponentAddress>
>                        </muws1:ReporterComponent>
>                        <muws2:Situation
> xmlns:muws2="http://docs.oasis-open.org
> /wsdm/muws2-2.xsd">
>                            <muws2:SituationCategory>
>                                <muws2:AvailabilitySituation/>
>                            </muws2:SituationCategory>
>
> <muws2:SituationTime>2009-05-21T15:27:04+08:00</muws
> 2:SituationTime>
>                            <muws2:Priority>70</muws2:Priority>
>                            <muws2:Message>Something important has  
> happened
> in t
> he muse-test.apache.org!</muws2:Message>
>                        </muws2:Situation>
>                        <shipmentCheckResultInfo
>
> xmlns="http://localhost:8080/ShipmentTrackService.xs
> d"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
> " xsi:schemaLocation="http://localhost:8080/ShipmentTrackService.xsd
> ShipmentTra
> ckService.xsd">
>                            <shipmentID>123</shipmentID>
>                            <shipmentOwner>bincan</shipmentOwner>
>                            <shipmentCheckResult>true</ 
> shipmentCheckResult>
>                        </shipmentCheckResultInfo>
>                    </muws1:ManagementEvent>
>                </wsnt:Message>
>            </wsnt:NotificationMessage>
>        </wsnt:Notify>
>    </soap:Body>
> </soap:Envelope>
>
> [Fatal Error] :5:184: The element type "HR" must be terminated by the
> matching e
> nd-tag "</HR>".
> 2009-5-21 15:31:06 org.apache.muse.util.LoggingUtils logError
> 信息: There was an error while processing a request:
>
> The element type "HR" must be terminated by the matching end-tag "</ 
> HR>".
>
>
> org. 
> apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien
> t.java:298)
>
> org. 
> apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien
> t.java:254)
>
> org. 
> apache.muse.ws.notification.remote.NotificationConsumerClient.notify
> (NotificationConsumerClient.java:99)
>
> org. 
> apache.muse.ws.notification.impl.SimpleSubscriptionManager.publish(S
> impleSubscriptionManager.java:267)
>
> org. 
> apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
> SimpleNotificationProducer.java:445)
>
> org. 
> apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
> SimpleNotificationProducer.java:473)
>
> org. 
> apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
> SimpleNotificationProducer.java:462)
>        org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1.run(Unknown  
> Source)
>
> ------------------------------------------
>
> 2009-5-21 15:31:21
> org.apache.muse.ws.notification.impl.SimpleSubscriptionManage
> r publish
> 信息: [ID = 'LastPublishFailed'] The last notification published via
> wsnt:Notify
> failed to reach its destination. The consumer may be unavailable. The
> original
> error was: The element type "HR" must be terminated by the matching  
> end-tag
> "</H
> R>".
> 2009-5-21 15:31:21 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
> 信息: Waiting 10 seconds before sending message...
> ******************************************************************
>
> and at wsn-consumer, it produced
>
> *******************************************************************
> [Fatal Error] :14:45: Element or attribute do not match QName  
> production:
> QName:
> :=(NCName':')?NCName.
> *******************************************************************
>
> What should I do? Modify wsn-consumer's code? And if,
> -- 
> View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23649285.html
> Sent from the Muse User mailing list archive at Nabble.com.
>

Re: Transport my own data types from wsn-producer to wsn-consumer

Posted by ciel <37...@qq.com>.
ok,thanks very much.
when I indroduced your code in wsn-producer, it produced:

*******************************************************
2009-5-21 15:27:50 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
信息: Sending message to consumers...
[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://192.168.
6.251:8080/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:a6a
c392c-e6b8-2cbc-895d-c04201eba23a</wsa:MessageID>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
            <wsa:ReferenceParameters
xmlns:wsa="http://www.w3.org/2005/08/addres
sing"/>
           
<wsa:Address>http://localhost:8080/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:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd"
                xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd"
                xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsnt="htt
p://docs.oasis-open.org/wsn/b-2">
                <wsnt:SubscriptionReference>
                    <wsa:Address
xmlns:wsa="http://www.w3.org/2005/08/addressing
">http://localhost:8080/wsn-producer/services/SubscriptionManager</wsa:Address>
                    <wsa:ReferenceParameters
xmlns:wsa="http://www.w3.org/2005/0
8/addressing">
                        <muse-wsa:ResourceId
xmlns:muse-wsa="http://ws.apache.or
g/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://ws.apache.org/muse/test/wsrf">tns:MyTopic</wsnt:Topi
c>
                <wsnt:ProducerReference>
                    <wsa:ReferenceParameters
xmlns:wsa="http://www.w3.org/2005/0
8/addressing"/>
                    <wsa:Address
xmlns:wsa="http://www.w3.org/2005/08/addressing
">http://localhost:8080/wsn-producer/services/WsResource</wsa:Address>
                </wsnt:ProducerReference>
                <wsnt:Message>
                    <muws1:ManagementEvent
                       
xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd
" ReportTime="2009-05-21T15:27:04+08:00">
                       
<muws1:EventId>uuid:ddeac1a5-5dcf-67fc-e17f-d71afce0fa5b
</muws1:EventId>
                        <muws1:SourceComponent>
                            <muws1:ComponentAddress>
                                <wsa:EndpointReference
xmlns:wsa="http://www.w3.
org/2005/08/addressing">
                                    <wsa:ReferenceParameters
xmlns:wsa="http://w
ww.w3.org/2005/08/addressing"/>
                                   
<wsa:Address>http://localhost:8080/wsn-produ
cer/services/WsResource</wsa:Address>
                                </wsa:EndpointReference>
                            </muws1:ComponentAddress>
                        </muws1:SourceComponent>
                        <muws1:ReporterComponent>
                            <muws1:ComponentAddress>
                                <wsa:EndpointReference
xmlns:wsa="http://www.w3.
org/2005/08/addressing">
                                    <wsa:ReferenceParameters
xmlns:wsa="http://w
ww.w3.org/2005/08/addressing"/>
                                   
<wsa:Address>http://localhost:8080/wsn-produ
cer/services/WsResource</wsa:Address>
                                </wsa:EndpointReference>
                            </muws1:ComponentAddress>
                        </muws1:ReporterComponent>
                        <muws2:Situation
xmlns:muws2="http://docs.oasis-open.org
/wsdm/muws2-2.xsd">
                            <muws2:SituationCategory>
                                <muws2:AvailabilitySituation/>
                            </muws2:SituationCategory>
                           
<muws2:SituationTime>2009-05-21T15:27:04+08:00</muws
2:SituationTime>
                            <muws2:Priority>70</muws2:Priority>
                            <muws2:Message>Something important has happened
in t
he muse-test.apache.org!</muws2:Message>
                        </muws2:Situation>
                        <shipmentCheckResultInfo
                           
xmlns="http://localhost:8080/ShipmentTrackService.xs
d"
                           
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
" xsi:schemaLocation="http://localhost:8080/ShipmentTrackService.xsd
ShipmentTra
                        <muws1:ReporterComponent>
                            <muws1:ComponentAddress>
                                <wsa:EndpointReference
xmlns:wsa="http://www.w3.
org/2005/08/addressing">
                                   
<wsa:Address>http://localhost:8080/wsn-produ
cer/services/WsResource</wsa:Address>
                                </wsa:EndpointReference>
                            </muws1:ComponentAddress>
                        </muws1:ReporterComponent>
                        <muws2:Situation
xmlns:muws2="http://docs.oasis-open.org
/wsdm/muws2-2.xsd">
                            <muws2:SituationCategory>
                                <muws2:AvailabilitySituation/>
                            </muws2:SituationCategory>
                           
<muws2:SituationTime>2009-05-21T15:27:04+08:00</muws
2:SituationTime>
                            <muws2:Priority>70</muws2:Priority>
                            <muws2:Message>Something important has happened
in t
he muse-test.apache.org!</muws2:Message>
                        </muws2:Situation>
                        <shipmentCheckResultInfo
                           
xmlns="http://localhost:8080/ShipmentTrackService.xs
d"
                           
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
" xsi:schemaLocation="http://localhost:8080/ShipmentTrackService.xsd
ShipmentTra
ckService.xsd">
                            <shipmentID>123</shipmentID>
                            <shipmentOwner>bincan</shipmentOwner>
                            <shipmentCheckResult>true</shipmentCheckResult>
                        </shipmentCheckResultInfo>
                    </muws1:ManagementEvent>
                </wsnt:Message>
            </wsnt:NotificationMessage>
        </wsnt:Notify>
    </soap:Body>
</soap:Envelope>

[Fatal Error] :5:184: The element type "HR" must be terminated by the
matching e
nd-tag "</HR>".
2009-5-21 15:31:06 org.apache.muse.util.LoggingUtils logError
信息: There was an error while processing a request:

The element type "HR" must be terminated by the matching end-tag "</HR>".

       
org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien
t.java:298)
       
org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClien
t.java:254)
       
org.apache.muse.ws.notification.remote.NotificationConsumerClient.notify
(NotificationConsumerClient.java:99)
       
org.apache.muse.ws.notification.impl.SimpleSubscriptionManager.publish(S
impleSubscriptionManager.java:267)
       
org.apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
SimpleNotificationProducer.java:445)
       
org.apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
SimpleNotificationProducer.java:473)
       
org.apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(
SimpleNotificationProducer.java:462)
        org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1.run(Unknown Source)

------------------------------------------

2009-5-21 15:31:21
org.apache.muse.ws.notification.impl.SimpleSubscriptionManage
r publish
信息: [ID = 'LastPublishFailed'] The last notification published via
wsnt:Notify
 failed to reach its destination. The consumer may be unavailable. The
original
error was: The element type "HR" must be terminated by the matching end-tag
"</H
R>".
2009-5-21 15:31:21 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
信息: Waiting 10 seconds before sending message...
******************************************************************

and at wsn-consumer, it produced

*******************************************************************
[Fatal Error] :14:45: Element or attribute do not match QName production:
QName:
:=(NCName':')?NCName.
*******************************************************************

What should I do? Modify wsn-consumer's code? And if, 
-- 
View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23649285.html
Sent from the Muse User mailing list archive at Nabble.com.


Re: Transport my own data types from wsn-producer to wsn-consumer

Posted by Lenni Madsen <l....@mil.dk>.
here's a bit of code that I introduced in my test case.

public Element runtimeEventOperation() throws Exception{
     	WefFactory factory = new SimpleWefFactory();
     	ManagementEvent event = factory.createEvent();
     	
     	Component reporter = factory.createComponent();
     	ComponentAddress reporterAddress =  
factory 
.createComponentAddress(getResource().getEndpointReference().toXML());
     	reporter.setAddress(reporterAddress);
     	reporter.setName(WefConstants.REPORTER_COMP_QNAME);
     	
     	Component source = factory.createComponent();
     	ComponentAddress sourceAddress =  
factory 
.createComponentAddress(getResource().getEndpointReference().toXML());
     	source.setAddress(sourceAddress);
     	source.setName(WefConstants.SOURCE_COMP_QNAME);
     	
     	Situation situation = factory.createSituation();
     	 
situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
     	situation.setPriority(Situation.HIGH_PRIORITY);
     	situation.setMessage("Something important has happened in the  
"+getServerName()+"!"); // this is your string only message
     	event.setReporter(reporter);
     	event.setSource(source);
     	event.setSituation(situation);
     	
     	event.addExtendedElement(MessageExtension()); // this is where  
you can put your XML, the standard allows for a xml extension
     	
     	try{
			runtimeNotification.publish(_TOPIC_NAME, event); // the actual  
request to send the notification
		}catch (Throwable error){
			error.printStackTrace();
		}
     	return event.toXML();
     }

/////// an example that should give the rough idea of how to build a  
wsn-producer

//
// MyCapability.java
// Thu Apr 05 11:59:12 BST 2007
// Generated by the Apache Muse Code Generation Tool
//
import javax.xml.namespace.QName;

import org.apache.muse.core.Resource;
import org.apache.muse.core.ResourceManager;
import org.apache.muse.util.xml.XmlUtils;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.dm.muws.events.Component;
import org.apache.muse.ws.dm.muws.events.ComponentAddress;
import org.apache.muse.ws.dm.muws.events.ManagementEvent;
import org.apache.muse.ws.dm.muws.events.Situation;
import org.apache.muse.ws.dm.muws.events.WefConstants;
import org.apache.muse.ws.dm.muws.events.WefFactory;
import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
import org.apache.muse.ws.notification.NotificationProducer;
import org.apache.muse.ws.notification.WsnConstants;
import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
import org.w3c.dom.Element;

public class MyCapability extends AbstractWsResourceCapability  
implements IMyCapability
{
	private NotificationProducer runtimeNotification;
	
	private static final QName _TOPIC_NAME = new QName(NAMESPACE_URI,  
"RuntimeEvent", PREFIX);
	/**
	 * Only internal objects are guarentied to be instantiated, do not  
depend on objects/Capabilities outside this Capability
	 */
     public void initialize() throws SoapFault
     {
         super.initialize();
     }
     /**
	 * External capabilities are instantiated and can be used
	 */
     public void initializeCompleted()throws SoapFault{
     	super.initializeCompleted();
     	runtimeNotification =  
(NotificationProducer 
)getResource().getCapability(WsnConstants.PRODUCER_URI);
		// add list of Topics if needed
		runtimeNotification.addTopic(_TOPIC_NAME);
     }

     /**
	 * External capabilities are instantiated and can be used (last chance)
	 */
	public void prepareShutdown() throws SoapFault{
		super.prepareShutdown();
	}
	/**
	 * Only internal objects are guaranteed to be instantiated, do not  
depend on objects/Capabilities outside this Capability
	 */
	public void shutdown() throws SoapFault{
		super.shutdown();
	}
	
     private static final QName[] _PROPERTIES = new QName[]
     {
     	new QName(NAMESPACE_URI, "ServerName", PREFIX),
         new QName(NAMESPACE_URI, "TestProperty", PREFIX),
         new QName(NAMESPACE_URI, "MessageInterval", PREFIX)
     };

     public QName[] getPropertyNames()
     {
         return _PROPERTIES;
     }

     private String _ServerName = "WsSomething";

     private String[] _TestProperty;

     private int _MessageInterval = 0;

     public String getServerName()
     {
         return _ServerName;
     }

     public void setServerName(String param0)
     {
         _ServerName = param0;
     }

     public String[] getTestProperty()
     {
         return _TestProperty;
     }

     public void setTestProperty(String[] param0)
     {
         _TestProperty = param0;
     }

     public int getMessageInterval()
     {
         return _MessageInterval;
     }

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

     public Element runtimeEventOperation() throws Exception{
     	WefFactory factory = new SimpleWefFactory();
     	ManagementEvent event = factory.createEvent();
     	
     	Component reporter = factory.createComponent();
     	ComponentAddress reporterAddress =  
factory 
.createComponentAddress(getResource().getEndpointReference().toXML());
     	reporter.setAddress(reporterAddress);
     	reporter.setName(WefConstants.REPORTER_COMP_QNAME);
     	
     	Component source = factory.createComponent();
     	ComponentAddress sourceAddress =  
factory 
.createComponentAddress(getResource().getEndpointReference().toXML());
     	source.setAddress(sourceAddress);
     	source.setName(WefConstants.SOURCE_COMP_QNAME);
     	
     	Situation situation = factory.createSituation();
     	 
situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
     	situation.setPriority(Situation.HIGH_PRIORITY);
     	situation.setMessage("Something important has happened in the  
"+getServerName()+"!");
     	event.setReporter(reporter);
     	event.setSource(source);
     	event.setSituation(situation);
     	
     	event.addExtendedElement(MessageExtension());
     	
     	try{
			getLog().info("Sending message to consumers...");
			runtimeNotification.publish(_TOPIC_NAME, event);
		}catch (Throwable error){
			error.printStackTrace();
		}
     	return event.toXML();
     }

     private Element MessageExtension(){
     	// create your XML message
     }
}

/Lenni

On May 20, 2009, at 10:47 GMT+02:00, ciel wrote:

>
> Hello,sir,
> I want to Transport my own data types  form wsn-producer to wsn- 
> consumer,
> such as follows:
>
> package org.apache.ws.muse.test.wsrf;
>
> class WsnTestDateType {
> 	WsnTestDateType (){};
> 	WsnTestDateType (int ID, String name){
> 		this.ID = ID;
> 		this.name = name;
> 	}
> 	public int getID() {
> 		return ID;
> 	}
> 	public void setID(int id) {
> 		ID = id;
> 	}
> 	public String getName() {
> 		return name;
> 	}
> 	public void setName(String name) {
> 		WsnTestDateType.name = name;
> 	}
> 	private static int ID;
> 	private static String name;
> }
> If I have done this
>
> WsnTestDateType studentMessage = new WsnTestDateType (int ID, String
> name)(int ID, String name);
>
> How could I use wsn.publish(_TOPIC_NAME, payload) to set  
> studentMessage to
> wsn-consumer and receive it? Any examples?
>
> Besides, if I replace WsnTestDateType  with a xml document as  
> follows, how
> should I do?
>
> //stuService.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <ns:stuInfo
> xmlns:ns="http://localhost:8080/stuService.xsd"><ns:shipmentID>1</ 
> ns:shipmentID>
>   <ns:stuID>25</ns:stuID>
>   <ns:stuName>Joe</ns:stuName>
> </ns:stuInfo>
>
> //stuService.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns="http://localhost:8080/stuService.xsd"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://localhost:8080/stuService.xsd"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> 	<xsd:element name="stuInfo">
> 		<xsd:complexType>
> 			<xsd:sequence>
> 				<xsd:element name="stuID" type="xsd:int"/>
> 				<xsd:element name="stuName" type="xsd:string"/>
> 			</xsd:sequence>
> 		</xsd:complexType>
> 	</xsd:element>
> </xsd:schema>
>
> Thanks very much. I am looking forward to your reply.
> -- 
> View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23631392.html
> Sent from the Muse User mailing list archive at Nabble.com.
>






Re: Transport my own data types form wsn-producer to wsn-consumer

Posted by ciel <37...@qq.com>.
some errors are showed above and
1) tomcat's logs localhost_log.2009-05-25.txt (wsn-producer):

2009-05-25 14:15:07
StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init():
ruleChain: [org.apache.webapp.balancer.RuleChain:
[org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News /
Redirect URL: http://www.cnn.com],
[org.apache.webapp.balancer.rules.RequestParameterRule: Target param name:
paramName / Target param value: paramValue / Redirect URL:
http://www.yahoo.com],
[org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL:
http://jakarta.apache.org]]
2009-05-25 14:15:07 StandardContext[/jsp-examples]ContextListener:
contextInitialized()
2009-05-25 14:15:07 StandardContext[/jsp-examples]SessionListener:
contextInitialized()
2009-05-25 14:15:07 StandardContext[/servlets-examples]ContextListener:
contextInitialized()
2009-05-25 14:15:07 StandardContext[/servlets-examples]SessionListener:
contextInitialized()
2009-05-25 14:16:03 StandardContext[/servlets-examples]ContextListener:
attributeReplaced('org.apache.catalina.WELCOME_FILES',
'[Ljava.lang.String;@42a818')

2) wsn-producer's log:
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ImmediateResourceTermination'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability 'http://docs.oasis-open.org/wsrf/rpw-2/Get'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability 'http://docs.oasis-open.org/wsrf/rpw-2/Query'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability 'http://docs.oasis-open.org/wsrf/rpw-2/Set'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://docs.oasis-open.org/wsn/bw-2/NotificationProducer'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/Identity'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/ManageabilityCharacteristics'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/Description'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/OperationalStatus'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'WsResource' has started
initialization of capability
'http://ws.apache.org/muse/test/wsrf/MyCapability'.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ImmediateResourceTermination.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rpw-2/Get.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rpw-2/Query.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rpw-2/Set.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsn/bw-2/NotificationProducer.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/Identity.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/ManageabilityCharacteristics.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/Description.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://docs.oasis-open.org/wsdm/muws/capabilities/OperationalStatus.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'WsResource'
has completed initialization of capability
'http://ws.apache.org/muse/test/wsrf/MyCapability.
2009-5-25 14:15:29 org.apache.muse.core.SimpleResource initialize
信息: [ID = 'ResourceInitialized'] The resource at 'WsResource' has been
initialized.
2009-5-25 14:15:29 org.apache.muse.core.routing.SimpleResourceRouter
initialize
信息: [ID = 'RouterIsInitialized'] The resource router has been initialized.
2009-5-25 14:15:29 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
信息: Waiting 10 seconds before sending message...
2009-5-25 14:15:29 org.apache.muse.util.LoggingUtils logMessage
良好: [SERVER TRACE] SOAP envelope contents (incoming):

<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:8080/wsn-producer/services/WsResource</wsa:To>
        <wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest</wsa:Action>
        <wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:5b0123cb-9fc9-b924-82b9-374e4d664be5</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:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <wsrf-rp:GetResourceProperty
            xmlns:pfx1="http://ws.apache.org/muse/test/wsrf"
xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2">pfx1:ServerName</wsrf-rp:GetResourceProperty>
    </soap:Body>
</soap:Envelope>


2009-5-25 14:15:29 org.apache.muse.util.LoggingUtils logMessage
良好: [SERVER 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://www.w3.org/2005/08/addressing/role/anonymous</wsa:To>
        <wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse</wsa:Action>
        <wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:f511d309-7855-5402-4df6-272ebb23d57c</wsa:MessageID>
        <wsa:RelatesTo xmlns:wsa="http://www.w3.org/2005/08/addressing"
RelationshipType="wsa:Reply">uuid:5b0123cb-9fc9-b924-82b9-374e4d664be5</wsa:RelatesTo>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
           
<wsa:Address>http://localhost:8080/wsn-producer/services/WsResource</wsa:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <wsrf-rp:GetResourcePropertyResponse
xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2">
            <pfx1:ServerName
xmlns:pfx1="http://ws.apache.org/muse/test/wsrf">muse-test.apache.org</pfx1:ServerName>
        </wsrf-rp:GetResourcePropertyResponse>
    </soap:Body>
</soap:Envelope>


2009-5-25 14:15:30 org.apache.muse.util.LoggingUtils logMessage
良好: [SERVER TRACE] SOAP envelope contents (incoming):

<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:8080/wsn-producer/services/WsResource</wsa:To>
        <wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.org/wsn/bw-2/NotificationProducer/SubscribeRequest</wsa:Action>
        <wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:60819b9b-cf02-6168-3c69-f2f8d0a0ee71</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:Address>
        </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://192.168.6.251:8080/wsn-consumer/services/consumer</wsa:Address>
            </wsnt:ConsumerReference>
        </wsnt:Subscribe>
    </soap:Body>
</soap:Envelope>


2009-5-25 14:15:30
org.apache.muse.ws.notification.impl.SimpleSubscriptionManager
setSubscriptionPolicy
警告: [ID = 'PolicyNotSupported'] WS-N SubscriptionPolicy is not supported.
The policy value was: null
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'SubscriptionManager' has
started initialization of capability
'http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata'.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'SubscriptionManager' has
started initialization of capability
'http://docs.oasis-open.org/wsrf/rpw-2/Get'.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'SubscriptionManager' has
started initialization of capability
'http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager'.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'SubscriptionManager' has
started initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ImmediateResourceTermination'.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'SubscriptionManager' has
started initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination'.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at
'SubscriptionManager' has completed initialization of capability
'http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at
'SubscriptionManager' has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rpw-2/Get.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at
'SubscriptionManager' has completed initialization of capability
'http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at
'SubscriptionManager' has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ImmediateResourceTermination.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at
'SubscriptionManager' has completed initialization of capability
'http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination.
2009-5-25 14:15:30 org.apache.muse.core.SimpleResource initialize
信息: [ID = 'ResourceInitialized'] The resource at 'SubscriptionManager' has
been initialized.
2009-5-25 14:15:30 org.apache.muse.util.LoggingUtils logMessage
良好: [SERVER 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://www.w3.org/2005/08/addressing/role/anonymous</wsa:To>
        <wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://docs.oasis-open.org/wsn/bw-2/NotificationProducer/SubscribeResponse</wsa:Action>
        <wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:77358c3e-1a0c-f364-f0d1-afe2c1ee7d89</wsa:MessageID>
        <wsa:RelatesTo xmlns:wsa="http://www.w3.org/2005/08/addressing"
RelationshipType="wsa:Reply">uuid:60819b9b-cf02-6168-3c69-f2f8d0a0ee71</wsa:RelatesTo>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
           
<wsa:Address>http://localhost:8080/wsn-producer/services/WsResource</wsa:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <wsnt:SubscribeResponse
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
            <wsnt:SubscriptionReference>
                <wsa:Address
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8080/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:CurrentTime>2009-05-25T14:15:30+08:00</wsnt:CurrentTime>
        </wsnt:SubscribeResponse>
    </soap:Body>
</soap:Envelope>


2009-5-25 14:15:39 org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1 run
信息: Sending message to consumers...
2009-5-25 14:15:41 org.apache.muse.util.LoggingUtils logError
信息: There was an error while processing a request:

The element type "HR" must be terminated by the matching end-tag "</HR>".


org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:298)

org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:254)

org.apache.muse.ws.notification.remote.NotificationConsumerClient.notify(NotificationConsumerClient.java:99)

org.apache.muse.ws.notification.impl.SimpleSubscriptionManager.publish(SimpleSubscriptionManager.java:267)

org.apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(SimpleNotificationProducer.java:445)

org.apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(SimpleNotificationProducer.java:473)

org.apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(SimpleNotificationProducer.java:462)
	org.apache.ws.muse.test.wsrf.MyCapabilityImpl$1.run(Unknown Source)
	
------------------------------------------

3) tomcat's logs localhost_log.2009-05-25.txt (wsn-consumer):
2009-05-25 14:15:07
StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init():
ruleChain: [org.apache.webapp.balancer.RuleChain:
[org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News /
Redirect URL: http://www.cnn.com],
[org.apache.webapp.balancer.rules.RequestParameterRule: Target param name:
paramName / Target param value: paramValue / Redirect URL:
http://www.yahoo.com],
[org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL:
http://jakarta.apache.org]]
2009-05-25 14:15:10 StandardContext[/jsp-examples]ContextListener:
contextInitialized()
2009-05-25 14:15:10 StandardContext[/jsp-examples]SessionListener:
contextInitialized()
2009-05-25 14:15:10 StandardContext[/servlets-examples]ContextListener:
contextInitialized()
2009-05-25 14:15:10 StandardContext[/servlets-examples]SessionListener:
contextInitialized()
2009-05-25 14:15:41 StandardWrapperValve[ApacheMuseServlet]:
Servlet.service() for servlet ApacheMuseServlet threw exception
java.io.IOException: Element or attribute do not match QName production:
QName::=(NCName':')?NCName. 
	at
org.apache.muse.core.platform.mini.MiniServlet.doPost(MiniServlet.java:81)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:595)

4) wsn-consumer's log:
2009-5-25 14:15:41 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'consumer' has started
initialization of capability
'http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer'.
2009-5-25 14:15:41 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitialized'] The resource at 'consumer' has started
initialization of capability 'http://ws.apache.org/muse/test/wsn/consumer'.
2009-5-25 14:15:41 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'consumer' has
completed initialization of capability
'http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer.
2009-5-25 14:15:41 org.apache.muse.core.SimpleResource
initializeCapabilities
良好: [ID = 'CapabilityInitializationComplete'] The resource at 'consumer' has
completed initialization of capability
'http://ws.apache.org/muse/test/wsn/consumer.
2009-5-25 14:15:41 org.apache.muse.core.SimpleResource initialize
信息: [ID = 'ResourceInitialized'] The resource at 'consumer' has been
initialized.
2009-5-25 14:15:41 org.apache.muse.core.routing.SimpleResourceRouter
initialize
信息: [ID = 'RouterIsInitialized'] The resource router has been initialized.

-- 
View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23701936.html
Sent from the Muse User mailing list archive at Nabble.com.


Re: Transport my own data types form wsn-producer to wsn-consumer

Posted by Chris Twiner <ch...@gmail.com>.
+1, although I have no idea what that should look like.

On Mon, May 25, 2009 at 7:14 AM, Lenni Madsen <l....@mil.dk> wrote:
> I'll bet it's related to that thread, could we once and for all agree that
> the current wsn-producer example is providing more issues than it helps
> remove.
>
> Guys, in the wsn-producer example from Muse there's a thread used, this is
> used ONLY to make the example run continuesly. The thread is not needed for
> a production version and is not in all the examples I've posted last week.
>
> I'll see if I can't cook up something
>
> On 25/05/2009, at 06.36, Chris Twiner <ch...@gmail.com> wrote:
>
>> Sorry, but could you please give more details of what doesn't work?
>> For example, log files, stack traces, messages sent etc.
>>
>> On Mon, May 25, 2009 at 5:16 AM, ciel <37...@qq.com> wrote:
>>>
>>> I have not solved the problem yet.
>>> my MyCapability's is as follows and I didn't change wsn-consumer' code
>>>
>>> package org.apache.ws.muse.test.wsrf;
>>>
>>> import java.io.File;
>>> import java.io.IOException;
>>>
>>> import javax.xml.namespace.QName;
>>> import javax.xml.parsers.DocumentBuilder;
>>> import javax.xml.parsers.DocumentBuilderFactory;
>>> import javax.xml.parsers.ParserConfigurationException;
>>>
>>> import org.apache.muse.ws.addressing.soap.SoapFault;
>>> import org.apache.muse.ws.dm.muws.events.Component;
>>> import org.apache.muse.ws.dm.muws.events.ComponentAddress;
>>> import org.apache.muse.ws.dm.muws.events.ManagementEvent;
>>> import org.apache.muse.ws.dm.muws.events.Situation;
>>> import org.apache.muse.ws.dm.muws.events.WefConstants;
>>> import org.apache.muse.ws.dm.muws.events.WefFactory;
>>> import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
>>> import org.apache.muse.ws.notification.NotificationProducer;
>>> import org.apache.muse.ws.notification.WsnConstants;
>>> import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
>>> import org.w3c.dom.Document;
>>> import org.w3c.dom.Element;
>>> import org.xml.sax.SAXException;
>>>
>>> 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()
>>>           {
>>>               //
>>>               // for this example, reuse one payload for every
>>> notification
>>>               //
>>>               QName messageName = new QName(NAMESPACE_URI, "MyMessage",
>>> PREFIX);
>>>               try
>>>               {
>>>                       payload = runtimeEventOperation();
>>>               }
>>>               catch (Exception e)
>>>               {
>>>                       e.printStackTrace();
>>>               }
>>>
>>>               while (true)
>>>               {
>>>                   try
>>>                   {
>>>                       //
>>>                       // read current value - property is mutable
>>>                       //
>>>                       int currentInterval = getMessageInterval();
>>> //                        System.out.println(payload);
>>>
>>>                       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();
>>>   }
>>>   private static ManagementEvent payload;
>>>   public ManagementEvent runtimeEventOperation() throws Exception{
>>>       WefFactory factory = new SimpleWefFactory();
>>>       ManagementEvent event = factory.createEvent();
>>>
>>>       Component reporter = factory.createComponent();
>>>       ComponentAddress reporterAddress =
>>>
>>> factory.createComponentAddress(getResource().getEndpointReference().toXML());
>>>       reporter.setAddress(reporterAddress);
>>>       reporter.setName(WefConstants.REPORTER_COMP_QNAME);
>>>
>>>       Component source = factory.createComponent();
>>>       ComponentAddress sourceAddress =
>>>
>>> factory.createComponentAddress(getResource().getEndpointReference().toXML());
>>>       source.setAddress(sourceAddress);
>>>       source.setName(WefConstants.SOURCE_COMP_QNAME);
>>>
>>>       Situation situation = factory.createSituation();
>>>
>>> situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
>>>       situation.setPriority(Situation.HIGH_PRIORITY);
>>>       situation.setMessage("Something important has happened in the
>>> "+getServerName()+"!");
>>>       event.setReporter(reporter);
>>>       event.setSource(source);
>>>       event.setSituation(situation);
>>>
>>>       event.addExtendedElement(MessageExtension());
>>>       return event;
>>> //        try{
>>> //                getLog().info("Sending message to consumers...");
>>> //                runtimeNotification.publish(_TOPIC_NAME, event);
>>> //                }
>>> //        catch (Throwable error){
>>> //                        error.printStackTrace();
>>> //                        }
>>> //        return event.toXML();
>>>      }
>>>
>>>      private Element MessageExtension()throws
>>> ParserConfigurationException, SAXException, IOException{
>>>       // create your XML message
>>>
>>>        File file = new
>>> File("E:/Awork/java/jakarta-tomcat-5.0.28/temp","test.xml");
>>>          DocumentBuilderFactory   dbf   =
>>> DocumentBuilderFactory.newInstance();
>>>          DocumentBuilder   db   =   dbf.newDocumentBuilder();
>>>          Document   doc   =   db.parse(file);
>>>          doc.normalize();
>>>          Element   root   =   doc.getDocumentElement();
>>>          return root;
>>>      }
>>> }
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23700618.html
>>> Sent from the Muse User mailing list archive at Nabble.com.
>>>
>>>
>

Re: Transport my own data types form wsn-producer to wsn-consumer

Posted by Lenni Madsen <l....@mil.dk>.
I'll bet it's related to that thread, could we once and for all agree  
that the current wsn-producer example is providing more issues than it  
helps remove.

Guys, in the wsn-producer example from Muse there's a thread used,  
this is used ONLY to make the example run continuesly. The thread is  
not needed for a production version and is not in all the examples  
I've posted last week.

I'll see if I can't cook up something

On 25/05/2009, at 06.36, Chris Twiner <ch...@gmail.com> wrote:

> Sorry, but could you please give more details of what doesn't work?
> For example, log files, stack traces, messages sent etc.
>
> On Mon, May 25, 2009 at 5:16 AM, ciel <37...@qq.com> wrote:
>>
>> I have not solved the problem yet.
>> my MyCapability's is as follows and I didn't change wsn-consumer'  
>> code
>>
>> package org.apache.ws.muse.test.wsrf;
>>
>> import java.io.File;
>> import java.io.IOException;
>>
>> import javax.xml.namespace.QName;
>> import javax.xml.parsers.DocumentBuilder;
>> import javax.xml.parsers.DocumentBuilderFactory;
>> import javax.xml.parsers.ParserConfigurationException;
>>
>> import org.apache.muse.ws.addressing.soap.SoapFault;
>> import org.apache.muse.ws.dm.muws.events.Component;
>> import org.apache.muse.ws.dm.muws.events.ComponentAddress;
>> import org.apache.muse.ws.dm.muws.events.ManagementEvent;
>> import org.apache.muse.ws.dm.muws.events.Situation;
>> import org.apache.muse.ws.dm.muws.events.WefConstants;
>> import org.apache.muse.ws.dm.muws.events.WefFactory;
>> import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
>> import org.apache.muse.ws.notification.NotificationProducer;
>> import org.apache.muse.ws.notification.WsnConstants;
>> import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
>> import org.w3c.dom.Document;
>> import org.w3c.dom.Element;
>> import org.xml.sax.SAXException;
>>
>> 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()
>>            {
>>                //
>>                // for this example, reuse one payload for every
>> notification
>>                //
>>                QName messageName = new QName(NAMESPACE_URI,  
>> "MyMessage",
>> PREFIX);
>>                try
>>                {
>>                        payload = runtimeEventOperation();
>>                }
>>                catch (Exception e)
>>                {
>>                        e.printStackTrace();
>>                }
>>
>>                while (true)
>>                {
>>                    try
>>                    {
>>                        //
>>                        // read current value - property is mutable
>>                        //
>>                        int currentInterval = getMessageInterval();
>> //                        System.out.println(payload);
>>
>>                        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();
>>    }
>>    private static ManagementEvent payload;
>>    public ManagementEvent runtimeEventOperation() throws Exception{
>>        WefFactory factory = new SimpleWefFactory();
>>        ManagementEvent event = factory.createEvent();
>>
>>        Component reporter = factory.createComponent();
>>        ComponentAddress reporterAddress =
>> factory. 
>> createComponentAddress(getResource().getEndpointReference().toXML());
>>        reporter.setAddress(reporterAddress);
>>        reporter.setName(WefConstants.REPORTER_COMP_QNAME);
>>
>>        Component source = factory.createComponent();
>>        ComponentAddress sourceAddress =
>> factory. 
>> createComponentAddress(getResource().getEndpointReference().toXML());
>>        source.setAddress(sourceAddress);
>>        source.setName(WefConstants.SOURCE_COMP_QNAME);
>>
>>        Situation situation = factory.createSituation();
>>
>> situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
>>        situation.setPriority(Situation.HIGH_PRIORITY);
>>        situation.setMessage("Something important has happened in the
>> "+getServerName()+"!");
>>        event.setReporter(reporter);
>>        event.setSource(source);
>>        event.setSituation(situation);
>>
>>        event.addExtendedElement(MessageExtension());
>>        return event;
>> //        try{
>> //                getLog().info("Sending message to consumers...");
>> //                runtimeNotification.publish(_TOPIC_NAME, event);
>> //                }
>> //        catch (Throwable error){
>> //                        error.printStackTrace();
>> //                        }
>> //        return event.toXML();
>>       }
>>
>>       private Element MessageExtension()throws
>> ParserConfigurationException, SAXException, IOException{
>>        // create your XML message
>>
>>         File file = new
>> File("E:/Awork/java/jakarta-tomcat-5.0.28/temp","test.xml");
>>           DocumentBuilderFactory   dbf   =
>> DocumentBuilderFactory.newInstance();
>>           DocumentBuilder   db   =   dbf.newDocumentBuilder();
>>           Document   doc   =   db.parse(file);
>>           doc.normalize();
>>           Element   root   =   doc.getDocumentElement();
>>           return root;
>>       }
>> }
>>
>> --
>> View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23700618.html
>> Sent from the Muse User mailing list archive at Nabble.com.
>>
>>

Re: Transport my own data types form wsn-producer to wsn-consumer

Posted by Chris Twiner <ch...@gmail.com>.
Sorry, but could you please give more details of what doesn't work?
For example, log files, stack traces, messages sent etc.

On Mon, May 25, 2009 at 5:16 AM, ciel <37...@qq.com> wrote:
>
> I have not solved the problem yet.
> my MyCapability's is as follows and I didn't change wsn-consumer' code
>
> package org.apache.ws.muse.test.wsrf;
>
> import java.io.File;
> import java.io.IOException;
>
> import javax.xml.namespace.QName;
> import javax.xml.parsers.DocumentBuilder;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.parsers.ParserConfigurationException;
>
> import org.apache.muse.ws.addressing.soap.SoapFault;
> import org.apache.muse.ws.dm.muws.events.Component;
> import org.apache.muse.ws.dm.muws.events.ComponentAddress;
> import org.apache.muse.ws.dm.muws.events.ManagementEvent;
> import org.apache.muse.ws.dm.muws.events.Situation;
> import org.apache.muse.ws.dm.muws.events.WefConstants;
> import org.apache.muse.ws.dm.muws.events.WefFactory;
> import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
> import org.apache.muse.ws.notification.NotificationProducer;
> import org.apache.muse.ws.notification.WsnConstants;
> import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> import org.xml.sax.SAXException;
>
> 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()
>            {
>                //
>                // for this example, reuse one payload for every
> notification
>                //
>                QName messageName = new QName(NAMESPACE_URI, "MyMessage",
> PREFIX);
>                try
>                {
>                        payload = runtimeEventOperation();
>                }
>                catch (Exception e)
>                {
>                        e.printStackTrace();
>                }
>
>                while (true)
>                {
>                    try
>                    {
>                        //
>                        // read current value - property is mutable
>                        //
>                        int currentInterval = getMessageInterval();
> //                        System.out.println(payload);
>
>                        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();
>    }
>    private static ManagementEvent payload;
>    public ManagementEvent runtimeEventOperation() throws Exception{
>        WefFactory factory = new SimpleWefFactory();
>        ManagementEvent event = factory.createEvent();
>
>        Component reporter = factory.createComponent();
>        ComponentAddress reporterAddress =
> factory.createComponentAddress(getResource().getEndpointReference().toXML());
>        reporter.setAddress(reporterAddress);
>        reporter.setName(WefConstants.REPORTER_COMP_QNAME);
>
>        Component source = factory.createComponent();
>        ComponentAddress sourceAddress =
> factory.createComponentAddress(getResource().getEndpointReference().toXML());
>        source.setAddress(sourceAddress);
>        source.setName(WefConstants.SOURCE_COMP_QNAME);
>
>        Situation situation = factory.createSituation();
>
> situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME);
>        situation.setPriority(Situation.HIGH_PRIORITY);
>        situation.setMessage("Something important has happened in the
> "+getServerName()+"!");
>        event.setReporter(reporter);
>        event.setSource(source);
>        event.setSituation(situation);
>
>        event.addExtendedElement(MessageExtension());
>        return event;
> //        try{
> //                getLog().info("Sending message to consumers...");
> //                runtimeNotification.publish(_TOPIC_NAME, event);
> //                }
> //        catch (Throwable error){
> //                        error.printStackTrace();
> //                        }
> //        return event.toXML();
>       }
>
>       private Element MessageExtension()throws
> ParserConfigurationException, SAXException, IOException{
>        // create your XML message
>
>         File file = new
> File("E:/Awork/java/jakarta-tomcat-5.0.28/temp","test.xml");
>           DocumentBuilderFactory   dbf   =
> DocumentBuilderFactory.newInstance();
>           DocumentBuilder   db   =   dbf.newDocumentBuilder();
>           Document   doc   =   db.parse(file);
>           doc.normalize();
>           Element   root   =   doc.getDocumentElement();
>           return root;
>       }
> }
>
> --
> View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23700618.html
> Sent from the Muse User mailing list archive at Nabble.com.
>
>

Re: Transport my own data types form wsn-producer to wsn-consumer

Posted by ciel <37...@qq.com>.
I have not solved the problem yet.
my MyCapability's is as follows and I didn't change wsn-consumer' code

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

import java.io.File;
import java.io.IOException;

import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.dm.muws.events.Component;
import org.apache.muse.ws.dm.muws.events.ComponentAddress;
import org.apache.muse.ws.dm.muws.events.ManagementEvent;
import org.apache.muse.ws.dm.muws.events.Situation;
import org.apache.muse.ws.dm.muws.events.WefConstants;
import org.apache.muse.ws.dm.muws.events.WefFactory;
import org.apache.muse.ws.dm.muws.events.impl.SimpleWefFactory;
import org.apache.muse.ws.notification.NotificationProducer;
import org.apache.muse.ws.notification.WsnConstants;
import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;

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()
            {
                //
                // for this example, reuse one payload for every
notification
                //
                QName messageName = new QName(NAMESPACE_URI, "MyMessage",
PREFIX);
                try
                {
                	payload = runtimeEventOperation();
                }
                catch (Exception e)
                {
                	e.printStackTrace();
                }
                
                while (true)
                {
                    try
                    {
                        //
                        // read current value - property is mutable
                        //
                        int currentInterval = getMessageInterval();
//                        System.out.println(payload);

                        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();
    }
    private static ManagementEvent payload;
    public ManagementEvent runtimeEventOperation() throws Exception{ 
        WefFactory factory = new SimpleWefFactory(); 
        ManagementEvent event = factory.createEvent(); 
        
        Component reporter = factory.createComponent(); 
        ComponentAddress reporterAddress = 
factory.createComponentAddress(getResource().getEndpointReference().toXML()); 
        reporter.setAddress(reporterAddress); 
        reporter.setName(WefConstants.REPORTER_COMP_QNAME); 
        
        Component source = factory.createComponent(); 
        ComponentAddress sourceAddress = 
factory.createComponentAddress(getResource().getEndpointReference().toXML()); 
        source.setAddress(sourceAddress); 
        source.setName(WefConstants.SOURCE_COMP_QNAME); 
        
        Situation situation = factory.createSituation(); 
       
situation.setCategoryType(WefConstants.AVAILABILITY_SITUATION_QNAME); 
        situation.setPriority(Situation.HIGH_PRIORITY); 
        situation.setMessage("Something important has happened in the
"+getServerName()+"!"); 
        event.setReporter(reporter); 
        event.setSource(source); 
        event.setSituation(situation); 
        
        event.addExtendedElement(MessageExtension()); 
        return event;
//        try{ 
//      	  getLog().info("Sending message to consumers..."); 
//      	  runtimeNotification.publish(_TOPIC_NAME, event); 
//      	  }
//        catch (Throwable error){ 
//      		  error.printStackTrace(); 
//      		  } 
//        return event.toXML(); 
       } 

       private Element MessageExtension()throws
ParserConfigurationException, SAXException, IOException{ 
        // create your XML message 
      	 
      	 File file = new
File("E:/Awork/java/jakarta-tomcat-5.0.28/temp","test.xml");
           DocumentBuilderFactory   dbf   =  
DocumentBuilderFactory.newInstance();     
           DocumentBuilder   db   =   dbf.newDocumentBuilder();   
           Document   doc   =   db.parse(file);   
           doc.normalize();
           Element   root   =   doc.getDocumentElement();   
           return root;
       } 
}

-- 
View this message in context: http://www.nabble.com/Transport-my-own-data-types--form-wsn-producer-to-wsn-consumer-tp23631392p23700618.html
Sent from the Muse User mailing list archive at Nabble.com.