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")
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).
Thanks a lot.
The Webservice use the JBoss Web component to authenticate the username and password (with Basic Authentication). (Note that i’m using JBoss-ESB)
For this motive, we need to change this jar (jbossweb.jar) in \jboss-esb\server\\deploy\jbossweb.sar.
We must edit the file “ServerInfo.properties” (in org\apache\catalina\util) and change the property “server.info=2.1.3.GA” to “server.info=XPTO”.
Alternatively, it´s also possible to re-build this jar and replace the tag @VERSION@ to XPTO (in the task Ant, i believe).
During this analysis, was also identified the possible implementation of our BasicAuthenticator. Thus it is possible to configure the error message (401) so as to make it more configurable (ultimately we can return other error).
To do this, you must change the configuration
in file war-deployers-jboss-beans.xml (in \jboss-esb\server\\deployers\jbossweb.deployer\META-INF).