Web service security not working. Java
- by Nitesh Panchal
Hello,
I have a ejb module which contains my ejbs as well as web services. I am using Netbeans 6.8 and Glassfish V3
I right clicked on my web service and clicked "edit web service attributes" and then checked "secure service" and then selected keystore of my server. This is my sun-ejb-jar.xml file :-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-ejb-jar>
<security-role-mapping>
<role-name>Admin</role-name>
<group-name>Admin</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>General</role-name>
<group-name>General</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>Member</role-name>
<group-name>Member</group-name>
</security-role-mapping>
<enterprise-beans>
<ejb>
<ejb-name>MemberBean</ejb-name>
<webservice-endpoint>
<port-component-name>wsMember</port-component-name>
<login-config>
<auth-method>BASIC</auth-method>
<realm>file</realm>
</login-config>
</webservice-endpoint>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
Here MemberBean is my ejb and wsMember is my webservice.
Then i made another project and added web service client and again right clicked on "edit web service attributes" and gave password as test and test. This username and password (test) is in Glassfish server in file realm. But when i try to invoke my webservice i always get
SEC5046: Audit: Authentication refused for [test].
SEC1201: Login failed for user: test
What am i doing wrong? Am i missing something?