Forum Stats

  • 3,851,951 Users
  • 2,264,054 Discussions
  • 7,904,915 Comments

Discussions

Error While accessing web service using weblogic security

idmr2
idmr2 Member Posts: 25
edited Mar 5, 2015 5:32AM in WebLogic Portal

Hi All,

I have developed basic web service which is secured by BASIC HTTP Authentication, While accessing its prompting for username and password. After giving credentials its throwing 401 Unauthorized Error.

1. After deploying war file in weblogic server, created user "testuser" and assigned group "role1".

Below is web.xml :

<?xml version = '1.0' encoding = 'windows-1252'?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

         version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">

  <servlet>

    <servlet-name>TestPort</servlet-name>

    <servlet-class>tetwebserviceproject.Test</servlet-class>

    <load-on-startup>1</load-on-startup>

  </servlet>

  <servlet-mapping>

    <servlet-name>TestPort</servlet-name>

    <url-pattern>/TestPort</url-pattern>

  </servlet-mapping>

<security-constraint>

    <web-resource-collection>

      <web-resource-name>testWebService</web-resource-name>

      <url-pattern>/TestPort</url-pattern>

    </web-resource-collection>

    <auth-constraint>

    <role-name>role1</role-name>

    </auth-constraint>

  </security-constraint>

  <login-config>

    <auth-method>BASIC</auth-method>

    <realm-name>myrealm</realm-name>

  </login-config>

  <security-role>

    <role-name>role1</role-name>

  </security-role>

</web-app>

Regards,

idmr2

This discussion has been closed.