axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darshan Jawalebhoi" <darshan_jawaleb...@persistent.co.in>
Subject RE: XMLStreamException "the prefix ==> Already exists for namespace" when WS-Security Rampart is engaged for Axis 2 web-services
Date Thu, 22 May 2008 08:10:51 GMT
Hey thanks for that quick workaround Richard. It worked for me too J

 

Darshan Jawalebhoi

http://curiousdeveloper.blogspot.com <http://curiousdeveloper.blogspot.com/> 

 

From: RICHARD FEATHERSTONE [mailto:ricshouse@btinternet.com] 
Sent: Thursday, May 15, 2008 3:16 PM
To: axis-user@ws.apache.org
Subject: Re: XMLStreamException "the prefix ==> Already exists for namespace" when WS-Security
Rampart is engaged for Axis 2 web-services

 

I also encountered this problem the other week. Due to time constraints I couldn't look into
it properly but tracked it down to the service response. We only require ws-security on the
inbound from the service so I edited the modules.xml in rampart to remove the outbound security
and this circumvents the problem.

 

It may help short term and I'll be watching this thread to find out what the issue is.

 

R

 

----- Original Message ----
From: Darshan Jawalebhoi <darshan_jawalebhoi@persistent.co.in>
To: axis-user@ws.apache.org
Sent: Thursday, 15 May, 2008 9:02:14 AM
Subject: XMLStreamException "the prefix ==> Already exists for namespace" when WS-Security
Rampart is engaged for Axis 2 web-services

Hi,

 

I tried to incorporate the WS-Security (using Rampart 1.3 module) feature to my existing set
of web-services. I am using AXIS 2 1.3. The java classes are generated using WSDL2JAVA. 

 

I get the following error in server logs while serialization of the certain responses (all
those which contain many "X" nodes under the "X-List" node) node since the time WS-Security
has been enabled:

 

****************************************************************************************************************************

 

12:22:22,344 ERROR [OMSourcedElementImpl] Could not get parser from data source for element


{http://services.mydomain.com/ws/schema/classificationservice}getInstructorListResponse

javax.xml.stream.XMLStreamException: the prefix ==>  Already exists for namespace ==>


http://services.mydomain.com/ws/schema/common/credentials

        at org.apache.axis2.databinding.utils.writer.MTOMAwareOMBuilder.getOMNamespace(MTOMAwareOMBuilder.java:72)

        at org.apache.axis2.databinding.utils.writer.MTOMAwareOMBuilder.writeStartElement(MTOMAwareOMBuilder.java:92)

        at com.mydomain.services.ws.schema.common.credentials.Credentials.serialize(Credentials.java:177)

        at com.mydomain.services.ws.schema.common.credentials.CredentialsList.serialize(CredentialsList.java:170)

        at com.mydomain.services.ws.schema.common.instructor.Instructor.serialize(Instructor.java:626)

        at com.mydomain.services.ws.schema.common.instructor.Instructors.serialize(Instructors.java:169)

        at com.mydomain.services.ws.schema.classificationservice.GetInstructorListResponse.serialize

(GetInstructorListResponse.java:226)

        at com.mydomain.services.ws.schema.classificationservice.GetInstructorListResponse$1.serialize

(GetInstructorListResponse.java:128)

        at org.apache.axis2.databinding.ADBDataSource.getReader(ADBDataSource.java:96)

        at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:129)

        at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:152)

        at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getFirstOMChild(OMSourcedElementImpl.java:755)

        at org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.java:141)

        at org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.java:113)

        at org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:96)

        at org.apache.axiom.om.impl.llom.OMStAXWrapper.updateNextNode(OMStAXWrapper.java:1007)

        at org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper.java:998)

        at org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:923)

        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153)

        at org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:447)

        at org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:479)

        at org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:130)

        at org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:150)

        at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:58)

        at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:64)

        at org.apache.axis2.engine.Phase.invoke(Phase.java:292)

        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)

        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:377)

        at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic

(AbstractInOutSyncMessageReceiver.java:45)

        at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)

        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)

        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)

        at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at com.mydomain.util.log.performance.filter.RequestIdentifierFilter.doFilter(RequestIdentifierFilter.java:60)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal

(OpenSessionInViewFilter.java:198)

        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)

        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)

        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

        at java.lang.Thread.run(Thread.java:595)

 

****************************************************************************************************************************

 

Consequently, the error received on in the web-service response is:

 

****************************************************************************************************************************

 

org.apache.axis2.AxisFault: Error in extracting message properties

                at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:70)

                at org.apache.axis2.engine.Phase.invoke(Phase.java:292)

                at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)

                at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:377)

                at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic

(AbstractInOutSyncMessageReceiver.java:45)

                at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)

                at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)

                at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)

                at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at com.mydomain.util.log.performance.filter.RequestIdentifierFilter.doFilter(RequestIdentifierFilter.java:60)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal

(OpenSessionInViewFilter.java:198)

                at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)

                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)

                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

                at java.lang.Thread.run(Thread.java:595)

Caused by: org.apache.rampart.RampartException: Error in extracting message properties

                at org.apache.rampart.RampartMessageData.&lt;init>(RampartMessageData.java:290)

                at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:58)

                at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:64)

                ... 35 more

Caused by: org.apache.ws.security.WSSecurityException: Error in converting SOAP Envelope to
Document; nested exception is: 

                org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException

                at org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:157)

                at org.apache.rampart.RampartMessageData.&lt;init>(RampartMessageData.java:150)

                ... 37 more

Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException

                at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:239)

                at org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:447)

                at org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:479)

                at org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:130)

                ... 38 more

Caused by: javax.xml.stream.XMLStreamException

                at org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper.java:1000)

                at org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:923)

                at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153)

 

****************************************************************************************************************************

 

I debugged the code and observed that, in the serialize method of the XML node POJO (generated
by WSDL2JAVA), the "MTOMAwareXMLStreamWriter xmlWriter"  parameter gets an instance of MTOMAwareOMBuilder
if WS-Security is enabled.

 

Whereas, without WS-Security it gets an instance of org.apache.axis2.databinding.utils.writer.MTOMAwareXMLSerializer
which uses MTOMXMLStreamWriter which in turn uses com.ctc.wstx.sw.SimpleNsStreamWriter to
serialize the response.

 

I also tried using AXIS 1.4 without any success.

 

Any idea how can this problem can be solved? Is there a way to let Rampart know which serializer
should be used? Am I missing any configuration details of Rampart? 

 

Darshan Jawalebhoi

http://curiousdeveloper.blogspot.com <http://curiousdeveloper.blogspot.com/> 

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which
is the property of Persistent Systems Ltd. It is intended only for the use of the individual
or entity to which it is addressed. If you are not the intended recipient, you are not authorized
to read, retain, copy, print, distribute or use this message. If you have received this communication
in error, please notify the sender and delete all copies of this message. Persistent Systems
Ltd. does not accept any liability for virus infected mails.

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent
Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed.
If you are not the intended recipient, you are not authorized to read, retain, copy, print,
distribute or use this message. If you have received this communication in error, please notify
the sender and delete all copies of this message. Persistent Systems Ltd. does not accept
any liability for virus infected mails.

Mime
View raw message