« Return to Thread: ws-security exception/fault handling
Shuangxi wrote:I am developing an app using ws-security. On the client, I added
DOMInHandler and WSS4JInHandler for the incomming message:
...
client.addInHandler(new DOMInHandler());
client.addInHandler(new WSS4JInHandler(inProperties));
On my server, I added DomOutHandler and WSS4JOutHandler for
the outgoing message (for the encryption):
....
<property name="outHandlers">
<list>
<ref bean="domOutHandler" />
<ref bean="wss4jOutHandler" />
</list>
</property>
...
If the server throws an exception when handling the service call from
the client, I can see the client got the exception message:
...
2006-09-05 12:16:03,093 DEBUG httpclient.wire.content - << "1"^M
2006-09-05 12:16:03,093 DEBUG httpclient.wire.content - << "7"^M
2006-09-05 12:16:03,093 DEBUG httpclient.wire.content - << "5"^M
2006-09-05 12:16:03,093 DEBUG httpclient.wire.content - << "[\r]"^M
2006-09-05 12:16:03,093 DEBUG httpclient.wire.content - << "[\n]"^M
2006-09-05 12:16:03,093 DEBUG httpclient.wire.content - <<
"<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body><soap:Fault><faultcode
xmlns:ns1="http://coplogic.com/authentication">ns1:INVALID_LOGIN</faultcode>
<faultstring>Invalid username/password.</faultstring></soap:Fault></soap:Body>
</soap:Envelope>"^M
2006-09-05 12:16:03,171 DEBUG org.codehaus.xfire.client.Client - Received
message to http://localhost:8080/dors/service/ReportService^
this error message goes through the client handling pipeline,
it failed when WSS4JInHandler calls WSSecurityEngine to process the
security header:
"WSS4JInHandler: Request does not contain required Security header"
It seems that the client's "in" handler expects all the messages from the
server to be encrypted, but the fault message doesn't look to be enrypted.
If I add DOMOutHandler and WSS4JOutHandler to fault handlers chain like this
(spring configuration):
...
<property name="faultHandlers">
<list>
<ref bean="domOutHandler" />
<ref bean="wss4jOutHandler" />
</list>
</property>
...
I will get a NAMESPACE_ERR exception. Here is the stacktrace:
2006-09-06 09:52:03,015 ERROR org.codehaus.xfire.handler.DefaultFaultHandler -
Could not send fault.^M org.w3c.dom.DOMException: NAMESPACE_ERR:
An attempt is made to create or change
an object in a way which is incorrect with regard to namespaces.^M
at
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.checkNamespaceWF
(CoreDocumentImpl.java:2388)^M
at
com.sun.org.apache.xerces.internal.dom.ElementNSImpl.setName
(ElementNSImpl.java:143)^M
at
com.sun.org.apache.xerces.internal.dom.ElementNSImpl.<init>
(ElementNSImpl.java:112)^M
at
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createElementNS
(CoreDocumentImpl.java:1969)^M
at
org.apache.ws.security.util.WSSecurityUtil.createElementInSameNamespace
(WSSecurityUtil.java:519)^M
at
org.apache.ws.security.util.WSSecurityUtil.findWsseSecurityHeaderBlock
(WSSecurityUtil.java:637)^M
at
org.apache.ws.security.message.WSSecHeader.insertSecurityHeader
(WSSecHeader.java:134)^M
at
org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:98)^M
at
org.codehaus.xfire.security.wss4j.WSS4JOutHandler.invoke
(WSS4JOutHandler.java:154)^M
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:110)^M
at
org.codehaus.xfire.handler.DefaultFaultHandler.sendFault
(DefaultFaultHandler.java:83)^M
at
org.codehaus.xfire.handler.DefaultFaultHandler.invoke
(DefaultFaultHandler.java:46)^M
at
org.codehaus.xfire.transport.DefaultEndpoint.onReceive
(DefaultEndpoint.java:71)^M
at
org.codehaus.xfire.transport.AbstractChannel.receive
(AbstractChannel.java:38)^M
at
org.codehaus.xfire.transport.http.XFireServletController.invoke
(XFireServletController.java:261)^M
at
org.codehaus.xfire.transport.http.XFireServletController.doService
(XFireServletController.java:120)^M
at
org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116)^M
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)^M
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)^M
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:252)^
...
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog^M
at [row,col {unknown-source}]: [1,0]^M
at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:628)^M
at
com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:1970)^M
at
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1883)^M
at com.ctc.wstx.sr.BasicStreamReader.next
(BasicStreamReader.java:1026)^M
at org.codehaus.xfire.util.STAXUtils.readDocElements(STAXUtils.java:556)^M
at org.codehaus.xfire.util.STAXUtils.read(STAXUtils.java:405)^M
at org.codehaus.xfire.util.dom.DOMInHandler.invoke(DOMInHandler.java:42)^M
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:110)^M
at org.codehaus.xfire.client.Client.onReceive(Client.java:382)^M
... 13 more^M
Please help.
Thanks,
shuangxi
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
« Return to Thread: ws-security exception/fault handling
| Free embeddable forum powered by Nabble | Forum Help |