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 "Vinh Nguyen (vinguye2)" <vi...@cisco.com> on 2006/11/08 18:37:55 UTC

complex type notifications

Capability implementations can return a complex type.  Does anyone know
if notifications can also return a complex type?  So far, I've only been
able to return string types successfully, but not complex types (ie. an
Element representing a complex type).
 
Instead of returning only plain string messages in notifications, I'd
like the ability to return a complex type so that the client end can
rebuild the pojo to extract relevant data.
 
The following code works, but seems to only expect plain string
messages:
 
    QName name= new QName(NAMESPACE_URI, "MyMessage", PREFIX);
    String msg = "This is a test message";
    Element payload = XmlUtils.createElement(name, msg);
    NotificationsProducer np = ...
    np.publish(TOPIC_NAME, payload);
 
The following code does not seem work when trying to pass a more
complicated message object.  I can see the outgoing trace show the
complex element, but it disappears on the incoming trace. No errors are
outputted either.
 
    QName name= new QName(NAMESPACE_URI, "MyMessage", PREFIX);
    Document doc = ...
    Element payload = doc.getDocumentElement();
    NotificationsProducer np = ...
    np.publish(TOPIC_NAME, payload);
 
Here's the trace from the latter code above:
 
[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://10.21.122.114:80
80/MuseDemo/services/SimpleWsnConsumer</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:e991aeb0-17a4-72be
-1197-3b58d2ff2255</wsa:MessageID>
        <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
            <wsa:ReferenceParameters
xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
 
<wsa:Address>http://10.21.122.114:8080/MuseDemo/services/SimpleWsnProduc
er</wsa:Address>
        </wsa:From>
    </soap:Header>
    <soap:Body>
        <wsnt:Notify xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
            <wsnt:NotificationMessage
                xmlns:="http://cisco.com/MuseDemo/BoxType"
                xmlns:muse-wsa="http://ws.apache.org/muse/addressing"
                xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
                <wsnt:SubscriptionReference>
                    <wsa:Address
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://10.21.122.114:80
80/MuseDemo/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</mu
se-wsa:ResourceId>
                    </wsa:ReferenceParameters>
                </wsnt:SubscriptionReference>
                <wsnt:Topic
 
Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete"
xmlns:wsnp="http://cisco.com/musebox/wsnp">wsnp:MyTopic2</wsnt:Topic>
                <wsnt:ProducerReference>
                    <wsa:ReferenceParameters
xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
                    <wsa:Address
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://10.21.122.114:80
80/MuseDemo/services/SimpleWsnProducer</wsa:Address>
                </wsnt:ProducerReference>
                <wsnt:Message>
                    <BoxType xmlns="http://cisco.com/MuseDemo/BoxType">
                        <width>123</width>
                        <height>123</height>
                    </BoxType>
                </wsnt:Message>
            </wsnt:NotificationMessage>
        </wsnt:Notify>
    </soap:Body>
</soap:Envelope>
 
[CLIENT TRACE] SOAP envelope contents (incoming):
 
<soapenv:Envelope
    xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <soapenv:Header>
        <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
        <wsa:ReplyTo>
 
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
        </wsa:ReplyTo>
 
<wsa:MessageID>urn:uuid:11E885D02CAE3E7713116300682676014</wsa:MessageID
>
 
<wsa:Action>http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer/Not
ifyRequest</wsa:Action>
        <wsa:RelatesTo
wsa:RelationshipType="http://www.w3.org/2005/08/addressing/reply">uuid:e
991aeb0-17a4-72be-1197-3b58d2ff2255</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body>
        <muse-op:NotifyResponse
            xmlns:muse-op="http://docs.oasis-open.org/wsn/b-2"
xmlns:tns="http://ws.apache.org/axis2"/>
    </soapenv:Body>
</soapenv:Envelope>