Skip to Main Content

Application Development Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Error While accessing web service using weblogic security

idmr2Mar 5 2015 — edited Mar 5 2015

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2015
Added on Mar 5 2015
0 comments
502 views