• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disable wsdl url in Axis 1.4

 
Rutger Meander
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I've looked quite some time for the following and am convinced that i'm looking for a solution in the wrong place.

I would like to disable the rendering of the wsdl for my webservice that one might trigger when using the ?wsdl parameter in the url.

Now i've tried quite some options in the wsdd.config file but can't figure out how to accomplisch this.

If someone could point me in the right direction or provide an answer i would be thankfull.

Cheers,

Rutger
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

It's odd - the documentation mentions that WSDL generation can be turned off on the individual service level, but it doesn't seem to mention how to do it.

In a quick look at the Axis 1.4 source I can't find any option to do this. One way around this might be to replace the QSWSDLHandler class (which creates the WSDL, and is referenced in the server-config.wsdd file) with your own class that returns nothing. The class is small, and it's not hard to figure out how it would have to be altered in the invoke method. (If you don't have the source handy, I've placed a copy of the source file here).

As an aside, you may also want to turn off the global axis.enableListQuery setting.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch Rutger,

Please check your private messages.
 
Rutger Meander
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf. Although my server-config.wsdd didn't reference the QSWSDLHandler class i looked it up and added the reference in the config file. After that i used the custom QSWSDLHandler class that you've provided and edited the file so that it would give an 403 error message.

Nevertheless, it's very strange that this has to be such a difficult task don't you think?

Again, thanks for helping me out.
[ October 16, 2007: Message edited by: Rutger Meander ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.

Yes, I do think it's strange, especially as the documentation states that it's possible to turn this off.
[ October 16, 2007: Message edited by: Ulf Dittmer ]
 
Benjamin Armbruster
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is also possible to extend the AxisServlet and this way setup a filtering for invalid arguments.
I think this solution might be one of the easiest ones.
You simply have to change the name from AxisServlet to AxisFilterServlet in the web.xml and
filter your requests similar to the following example:



/**
* Servlet that is used to display Access Denied Messaged
*
* @author Benjamin.Armbruster
*
*/
public class AxisFilterServlet extends AxisServlet {

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
if (req.getParameterValues("wsdl") != null) {
String[] wsdlParam = req.getParameterValues("wsdl");
boolean returnNotFound = false;
for (int i = 0; i < wsdlParam.length; i++) {
returnNotFound |= (wsdlParam[i] != null && wsdlParam[i].equals(""));
}

if (returnNotFound) {
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
} else {
super.service(req, resp);
}
} else {
super.service(req, resp);
}
}
}

 
uncel same
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use the <wsdlFile> tag and suplly an empty/false/generic WSDL file???

<service name="Test" provider="java:RPC" >
...
<wsdlFile>/org/someone/res/mywsdl.wsdl</wsdlFile>
<!-- <wsdlFile>WEB-INF/wsdls/mywsdl.wsdl</wsdlFile> -->
...
</service>

Uncel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic