[jboss-dev-forums] [JBoss Web Services Development] - Custom 401 Error on Webservices (JBoss)

João Marques do-not-reply at jboss.com
Fri Apr 27 13:28:25 EDT 2012


João Marques [https://community.jboss.org/people/_marquez2012_] created the discussion

"Custom 401 Error on Webservices (JBoss)"

To view the discussion, visit: https://community.jboss.org/message/732747#732747

--------------------------------------------------------------
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
[https://community.jboss.org/message/732747#732747]

Start a new discussion in JBoss Web Services Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2047]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120427/800da1aa/attachment.html 


More information about the jboss-dev-forums mailing list