wood burning stoves*
The moose likes Web Services and the fly likes Disable wsdl url in Axis 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Disable wsdl url in Axis 1.4" Watch "Disable wsdl url in Axis 1.4" New topic
Author

Disable wsdl url in Axis 1.4

Rutger Meander
Greenhorn

Joined: Oct 15, 2007
Posts: 2
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
Marshal

Joined: Mar 22, 2005
Posts: 39530
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Welcome to JavaRanch Rutger,

Please check your private messages.


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Rutger Meander
Greenhorn

Joined: Oct 15, 2007
Posts: 2
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
Marshal

Joined: Mar 22, 2005
Posts: 39530
    
  27
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

Joined: Jan 08, 2009
Posts: 1
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

Joined: Sep 20, 2010
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disable wsdl url in Axis 1.4
 
Similar Threads
How to re-generate a WSDL
Remove auto-generated WS Info
Future of WebServices
Must read for SCJA
WebServiceException: HTTP Status-Code 404