JBoss Community

Custom 401 Error on Webservices (JBoss)

created by João Marques in JBoss Web Services Development - View the full discussion

Hi,

 

I have a jboss webservice like this:

 

@Stateless
@SecurityDomain("SecurityDomain")
@RolesAllowed("RolesAllowed")
@WebContext(urlPattern = "/*", authMethod = "BASIC", secureWSDLAccess = true)
@EndpointConfig(configName = "Standard WSSecurity Endpoint")
@WebService(name = "WebServiceName", targetNamespace = "http://webserviceName")

public class WebserviceName (...)

 

 

When i invoke this webservice with wrong credentials i´m getting the following error:

 

<html>
<head>
<title>JBoss Web/2.1.3.GA - Error report</title>
<style>
<!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-    size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-   size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-  family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}
A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head>
<body><h1>HTTP Status 401 - </h1><HR size="1" noshade="noshade">
<p><b>type</b> Status report</p>
<p><b>message</b> <u></u></p>
<p><b>description</b> <u>This request requires HTTP authentication ().</u></p>
<HR size="1" noshade="noshade"><h3>JBoss Web/2.1.3.GA</h3>
</body>
</html>

 

I would like to know if there is way to custom this 401 response?

Notice that my webservice works fine (my problem is only in this customization).

I already try, unsucessefully,  to put the following code on web.xml (in several modules like jbossws.sar) (and login-config.xml)

  <error-page>

<error-code>401</error-code>

<location>/test.html</location>

</error-page>

Also, i´ve try the following:

<error-page>

    <exception-type>com.xpto.MyException</exception-type>

    <location>/test.html</location>

</error-page>

 

Thanks a lot.


Reply to this message by going to Community

Start a new discussion in JBoss Web Services Development at Community