You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sudhir Mongia <su...@gmail.com> on 2009/04/07 13:40:08 UTC

Facing Problem while Implementing WSSecurity Token based Authentication

Hi,
I have created a sample Say Hello Webservice and I am trying to do basic
implementation of WSSecurity using Axis2 and RamPart.

I am following the tutorial http://wso2.org/library/3190. Apart from this
also followed the link http://wso2.org/library/3787.which addresses
the compatibility issues with Axis2 1.4 and rampart 1.4. I have policy added
in services.xml and at bindings level in WSDL. At the end when I am trying
to run it I am getting "Invalid Security Error".

Here is the details of Environment
Axis2 version :Axis2 1.4
Rampart version: Rampart 1.4
Application Server :JBoss 4.0.5

WSDL file and services.xml is attached with this email.

I have pasted here request and response soap message, captured from TCPMON.
I have given the errors which I am getting on server side and client side.

Request SOAP Message

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header>
<wsse:Security xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
soapenv:mustUnderstand="true">
<wsse:UsernameToken xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="UsernameToken-31658378">
<wsse:Username>apache</wsse:Username>
<wsse:Password Type="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
">password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ns1:sayHello xmlns:ns1="http://HelloWeb/xsd">
<ns1:param0>Sudhir Mongia 1</ns1:param0>
</ns1:sayHello>
</soapenv:Body>
</soapenv:Envelope>

Response Soap Message

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code>
<soapenv:Reason><soapenv:Text
xml:lang="en-US">InvalidSecurity</soapenv:Text></soapenv:Reason>
<soapenv:Detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>


Error on Client side
org.apache.axis2.AxisFault: InvalidSecurity
at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at
com.sample.webservice.client.HelloWebServiceStub.sayHello(HelloWebServiceStub.java:192)
at com.sample.webservice.client.TestWebService.main(TestWebService.java:52)

Error on Server side
16:10:00,138 INFO  [STDOUT] 16:10:00,138 ERROR [AxisEngine] InvalidSecurity
org.apache.axis2.AxisFault: InvalidSecurity
        at
org.apache.rampart.handler.PostDispatchVerificationHandler.invoke(PostDispatchVerificationHandler.java:143)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
        at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
        at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:131)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
        at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
        at java.lang.Thread.run(Thread.java:595)


Any Pointer on this. Please let me know, if you need more information from
my side.

Thanks,
Sudhir

Re: Facing Problem while Implementing WSSecurity Token based Authentication

Posted by Nandana Mihindukulasooriya <na...@gmail.com>.
Hi Sudhir,
       The problem is, at the Rampart handler, effective policy is not found
correctly. Can you please try with addressing engaged ?  This will help to
pin down the issue.

thanks,
Nandana

On Tue, Apr 7, 2009 at 5:10 PM, Sudhir Mongia <su...@gmail.com>wrote:

> Hi,
> I have created a sample Say Hello Webservice and I am trying to do basic
> implementation of WSSecurity using Axis2 and RamPart.
>
> I am following the tutorial http://wso2.org/library/3190. Apart from this
> also followed the link http://wso2.org/library/3787.which addresses
> the compatibility issues with Axis2 1.4 and rampart 1.4. I have policy added
> in services.xml and at bindings level in WSDL. At the end when I am trying
> to run it I am getting "Invalid Security Error".
>
> Here is the details of Environment
> Axis2 version :Axis2 1.4
> Rampart version: Rampart 1.4
> Application Server :JBoss 4.0.5
>
> WSDL file and services.xml is attached with this email.
>
> I have pasted here request and response soap message, captured from TCPMON.
> I have given the errors which I am getting on server side and client side.
>
> Request SOAP Message
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
>  <soapenv:Header>
>  <wsse:Security xmlns:wsse="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
> soapenv:mustUnderstand="true">
>  <wsse:UsernameToken xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> wsu:Id="UsernameToken-31658378">
>  <wsse:Username>apache</wsse:Username>
>  <wsse:Password Type="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
> ">password</wsse:Password>
>  </wsse:UsernameToken>
>  </wsse:Security>
>  </soapenv:Header>
>  <soapenv:Body>
>  <ns1:sayHello xmlns:ns1="http://HelloWeb/xsd">
>  <ns1:param0>Sudhir Mongia 1</ns1:param0>
>  </ns1:sayHello>
>  </soapenv:Body>
> </soapenv:Envelope>
>
> Response Soap Message
>
> <?xml version='1.0' encoding='UTF-8'?>
>  <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope
> ">
>  <soapenv:Body>
>  <soapenv:Fault>
>
> <soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code>
>  <soapenv:Reason><soapenv:Text
> xml:lang="en-US">InvalidSecurity</soapenv:Text></soapenv:Reason>
>  <soapenv:Detail />
>  </soapenv:Fault>
>  </soapenv:Body>
>  </soapenv:Envelope>
>
>
> Error on Client side
> org.apache.axis2.AxisFault: InvalidSecurity
>  at
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
>  at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
>  at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
>  at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
>  at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>  at
> com.sample.webservice.client.HelloWebServiceStub.sayHello(HelloWebServiceStub.java:192)
>  at
> com.sample.webservice.client.TestWebService.main(TestWebService.java:52)
>
> Error on Server side
> 16:10:00,138 INFO  [STDOUT] 16:10:00,138 ERROR [AxisEngine] InvalidSecurity
> org.apache.axis2.AxisFault: InvalidSecurity
>         at
> org.apache.rampart.handler.PostDispatchVerificationHandler.invoke(PostDispatchVerificationHandler.java:143)
>         at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
>         at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
>         at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
>         at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
>         at
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:131)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>         at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
>         at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>         at
> org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>         at
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
>         at java.lang.Thread.run(Thread.java:595)
>
>
> Any Pointer on this. Please let me know, if you need more information from
> my side.
>
> Thanks,
> Sudhir
>
>
>


-- 
Nandana Mihindukulasooriya
WSO2 inc.

http://nandana83.blogspot.com/
http://www.wso2.org