I'm actually surprised the DOM code adds anything to your message payload 
- you're accessing the DOM Document, not the root Element, with 
getDocumentElement(). That Document is the factory that created the 
Element, but it is not necessarily attached to the Element (that is, 
appendChild() was never called). Try this:

XmlUtils.getFirstElement(doc);

instead of:

doc.getDocumentElement();  // returns 'this'


try that, and also let me know the output from the code in my recent 
email.

Dan



"Vinh Nguyen \(vinguye2\)" <[EMAIL PROTECTED]> wrote on 11/08/2006 
12:46:18 PM:

> I forgot to mention that the trace below is seen in the Tomcat stdout
> logs.  The notification itself doesn't even get sent out to the
> NotificationProducer's listeners.  I tested this by putting a debug
> statement in the NotificationMessageListener.accepts() method, and it
> wasn't being called.  It was only being called successfully for plain
> string notifications.  So something is hindering the
> NotificationProducer from sending out complex type notifications, but no
> error is thrown to indicate what the problem is.
> 
> 
> -----Original Message-----
> From: Vinh Nguyen (vinguye2) 
> Sent: Wednesday, November 08, 2006 9:38 AM
> To: [email protected]
> Subject: 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>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to