I've encountered the same situation that Erik describes. Another, likely related case, is that the topicName also expects an explicit namespace prefix.
The following invocation (which is similar to what is shown in one of the
samples):
wsn.publish(new QName("http://www.abc.com/Topics", "Default"),
payload);
Results in the following invalid segment in the NotificationMessage:
<wsnt:Topic
Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete"
xmlns:="http://www.abc.com/Topics">Default</wsnt:Topic>
If the publish invocation is modified so that the QName declares the
prefix, then the message is generated is valid.
wsn.publish(new QName("http://www.abc.com/Topics", "Default",
"xyz"), payload);
Is this the same bug as described by Erik (assuming it is a bug)?
Regards,
Kam Yee
Erik Rissanen <[EMAIL PROTECTED]>
05/19/2007 07:11 AM
Please respond to
[email protected]
To
[email protected]
cc
Subject
Problem with namespace prefix in notifications
Hello,
I am having an issue with Muse and notifications.
I have a service which processes a request and I want to generate a
notification about this request and the corresponding response.
I am creating the notification like the following in the code. Response
and respDoc are the request and response which I want to include in the
notification.
QName messageName = new QName(NAMESPACE_URI, "AccessRequest",
PREFIX);
Element payload = XmlUtils.createElement(messageName);
Node importedReq =
payload.getOwnerDocument().importNode(Request, true);
Node importedResp = payload.getOwnerDocument().importNode
(respDoc.getDocumentElement(), true);
payload.appendChild(importedReq);
payload.appendChild(importedResp);
NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);
wsn.publish(topic_name, payload);
The XML which I include as children in the message do not use namespace
prefixes, but a default namespace (xmlns="...").
Muse seems to try to collect the namespace prefixes from the message
contents, which causes broken XML like this:
<wsnt:NotificationMessage
xmlns:="urn:oasis:names:tc:xacml:3.0:schema:os"
....
>
....
<wsnt:Message>
<tns:AccessRequest
xmlns:tns="...">
<Request
xmlns="urn:oasis:names:tc:xacml:3.0:schema:os">
....
(Note the xmlns:="..." on the second line.)
I have not tried to trace the source of this error in the code. I think
that for now I will just rewrite the XML before it is included in the
notification message.
Is this a bug in Muse? (Or did I do something wrong.) If it is a bug, I
can create a bug tracking item for it.
Regards,
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
smime.p7s
Description: S/MIME Cryptographic Signature
