Enable WebDAV for Cognos using Apache

I don’t know why, but when you install Cognos and you want to use pictures, it’s not available out of the box. You always have to fiddle around with web server settings before you can actually use pictures in your report. So when you are e.g. in IBM Cognos Report Studio and you drag an image from the toolbox onto your report page you will get an error stating something like “Web server error: The web request failed. 501 – Not Implemented”.

In order to be able to browse and select pictures you need to enable WebDAV. If you use Apache as a web server for Cognos it is relatively easy to enable WebDAV on the Apache web server. This blog shows the steps to do this using IBM Cognos Express 10.1 with a default installation including Apache. If you have a IBM Cognos BI installation using Apache or you are using a seperately installed Apache instance, the steps are the same, just the file locations will be different.

The steps described here use the default setup, meaning on the server within the Cognos installation directory. In a production environment my advise would be to keep the server as clean as possible and store the images on a share elsewhere and make that share accessible. 

1. Create a folder where you will store the images you want to use within Cognos. This folder should be accessible from the web. In a standard installation this means creating a folder like …\IBM Cognos Installation Directory\webapps\p2pd\images.

2. Then go to …\IBM Cognos Installation Directory\webapps\p2pd\WEB-INF and locate the web.xml file. This is an … eh .. XML file that defines (almost) all the things the web server needs to know, it”s the application deployment descriptor. So if WebDAV should be enabled, the web.xml file is the place to be.

3. Open the web.xml file in a text editor, preferably something like this. If you have no idea what XML is, don’t worry, .. just don’t mess it up. 

4. Insert the following code into the web.xml file. Place the <servlet>…</servlet> part where the other servlets are can be found and do the same for the <servlet-mapping>, make sure that the servlet mapping bit comes after the servlet part. Replace “YOURIMAGELOCATION” with the foldername that you created within the webapps\p2pd folder.

  <!-- WebDAV enable the app --> 
  <servlet> 
    <servlet-name>webdav</servlet-name> 
    <servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class> 
    <init-param> 
      <param-name>debug</param-name> 
      <param-value>0</param-value> 
    </init-param> 
    <init-param> 
      <param-name>listings</param-name> 
      <param-value>true</param-value> 
    </init-param> 
    <init-param> 
      <param-name>readonly</param-name> 
      <param-value>true</param-value> 
    </init-param> 
    <!--load-on-startup>1</load-on-startup--> 
  </servlet> 

  <!-- The mapping for the WebDAV servlet --> 
  <servlet-mapping> 
    <servlet-name>webdav</servlet-name> 
    <url-pattern>/YOURIMAGELOCATION/</url-pattern> 
  </servlet-mapping>

 

Enable WebDAV for Cognos in Apache

5. Save the web.xml file and restart the web server. If you are using it out of the box with IBM Cognos Express, then go to the management console and restart CX. 

This should basically do the trick, but it can be common that you still don’t see the pictures, this can very much depend on other factors as well, file folder access, network settings, other web-server settings etc.

Cognos Service