-
1. Re: javax.xml.stream.XMLStreamException: Trying to declare prefix xmlns
ffang Apr 29, 2010 9:28 PM (in response to suxuguang)Hi,
The execption
Trying to declare prefix xmlns
means you have some prefix declaration like
xmlns:xmlns
from your message, it's incorrect per xml spec
The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. It MUST NOT be declared . Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace. Element names MUST NOT have the prefix xmlns.
Freeman
Edited by: ffang on Apr 30, 2010 1:24 AM
-
2. Re: javax.xml.stream.XMLStreamException: Trying to declare prefix xmlns
suxuguang May 4, 2010 11:28 AM (in response to ffang)Thanks Freeman.
Now I have removed the re-declaration of xmlns from the notify message I send from my client and still get the same error.
I noticed 2 strange things:
1) Event though the re-declaration did not exists in the message incoming to the consumer:
---
10:45:06,171 | DEBUG | pool-flow.seda.servicemix-wsn2005-thread-5 | SedaQueue | org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1 132 | org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@17381ef dequeued exchange: InOnly[
id: ID:10.10.6.79-12863c658e6-4:1
status: Done
role: consumer
interface: NotificationBroker
service: NotificationBroker
endpoint: Broker
operation: Notify
in: <?xml version="1.0" encoding="UTF-8"?><jbi:message xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper" xmlns:msg="http://docs.oasis-open.org/wsn/bw-2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Notify" type="msg:Notify" version="1.0"><jbi:part><ns3:Notify xmlns:ns3="http://docs.oasis-open.org/wsn/b-2" xmlns:ns2="http://www.w3.org/2005/08/addressing" xmlns:ns4="http://docs.oasis-open.org/wsrf/rp-2" xmlns:ns5="http://docs.oasis-open.org/wsn/br-2" xmlns:ns6="http://docs.oasis-open.org/wsn/t-1" xmlns:ns7="http://docs.oasis-open.org/wsrf/r-2"><ns3:NotificationMessage><ns3:Topic Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple">ABC</ns3:Topic><ns3:Message>
some text
</ns3:Message></ns3:NotificationMessage></ns3:Notify></jbi:part></jbi:message>
]
-
It appears when it comes to the provider:
---
10:45:06,171 | DEBUG | pool-flow.seda.servicemix-cxf-bc-thread-1 | SedaQueue | org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1 132 | org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@57b13a dequeued exchange: InOnly[
id: ID:10.10.6.79-12863c658e6-21:0
status: Active
role: provider
endpoint: NotificationConsumer
in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify xmlns:ns2="http://docs.oasis-open.org/wsn/b-2" xmlns="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns4="http://docs.oasis-open.org/wsrf/rp-2" xmlns:ns5="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple">ABC</ns2:Topic><ns2:Message>
some text
</ns2:Message></ns2:NotificationMessage></ns2:Notify>
]
-
I used "endpoint:http://docs.oasis-open.org/wsn/bw-2/NotificationConsumerService/NotificationConsumer" to subscribe in this case.
2) When I use "http://mymachine:8080/ENCWebService-tomcat-6.0.18/services/ENC?http.soap=true" to subscribe the notification did go through to the target machine, but I still see the added re-declaration when it gets to the provider:
---
10:50:19,375 | DEBUG | pool-flow.seda.servicemix-http-thread-1 | SedaQueue | org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1 132 | org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@42cbda dequeued exchange: InOnly[
id: ID:10.10.6.79-12863caf46a-21:0
status: Active
role: provider
endpoint: http://mymachine:8080/ENCWebService-tomcat-6.0.18/services/ENC?http.soap=true
in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify xmlns:ns2="http://docs.oasis-open.org/wsn/b-2" xmlns="http://www.w3.org/2005/08/addressing" xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns4="http://docs.oasis-open.org/wsrf/rp-2" xmlns:ns5="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple">ABC</ns2:Topic><ns2:Message>
some text
</ns2:Message></ns2:NotificationMessage></ns2:Notify>
]
---
even though it is not in my original message.
Looks like some servicemix code somewhere added that declaration. Also, cxf-bc component seems to check for the illegal re-declaration but http component does not.
Is there any way I can work around this problem?
Thanks!