How to build a Confluence SOAP client in 5 minutes

March 28th, 2010 by

In this tutorial we are going to build a SOAP client for the popular Confluence Wiki in about five minutes. The client is going to receive rendered HTML Markup from a specified Confluence Page.



  • A running Confluence Installation with SOAP API enabled – if you don’t already have one  take a look at this article or if you’ve got the Atlassian Plugin SDK installed .. start a standalone instance using atlas-run-standalone ..
  • Maven – never go without it ;)
  • Five minutes of your life time ..

Project Setup / Dependencies

  1. Create a new Maven project:
    mvn archetype:generate ...
  2. Edit the pom.xml and add the dependencies for the axistools plugin – I’m using an older version of axis here because of some Confluence SOAP dialect in some versions ;)

Service Stub and SOAP Client

Now that we’ve got everything we need, we’re ready to create our soap client.

  1. Start your Confluence instance, ensure it is running ..
  2. Change to the Confluence administration console, click “General Configuration” > “Feature Settings” > “Remote API (XML-RPC & SOAP)” and activate this feature
  3. Now you should be able to view the WSDL for Confluence – point your browser to: http://localhost:8080/rpc/soap-axis/confluenceservice-v1?wsdl (newer Confluence versions use: http://localhost:8080/rpc/soap-axis/confluenceservice-v2?wsdl)
  4. Create a directory named wsdl in src/main in the project directory
  5. Save the wsdl file in the created wsdl directory – the axistool plugin searches for wsdl files at this location
  6. Run the following command to create the skeleton files:
    mvn axistools:wsdl2java
  7. Now we got all we need in target/generated-classes
  8. We create a new package named com.hascode.confluence.rpc
  9. In this package we create a new class named PageReader:
    package com.hascode.confluence.rpc;
    import javax.xml.rpc.ServiceException;
    import localhost.confluence.rpc.soap_axis.confluenceservice_v2.ConfluenceSoapService;
    import localhost.confluence.rpc.soap_axis.confluenceservice_v2.ConfluenceSoapServiceServiceLocator;
    import com.atlassian.confluence.rpc.AuthenticationFailedException;
    import com.atlassian.confluence.rpc.RemoteException;
    import com.atlassian.confluence.rpc.soap.beans.RemotePage;
    public class PageReader {
    	public static void main(final String[] args)
    			throws AuthenticationFailedException, RemoteException,
    			java.rmi.RemoteException, ServiceException {
    		final ConfluenceSoapService service;
    		ConfluenceSoapServiceServiceLocator serviceLocator = new ConfluenceSoapServiceServiceLocator();
    		service = serviceLocator.getConfluenceserviceV2();
    		// insert your account data here
    		String token = service.login("theuser", "thepassword");
    		// we are going to fetch a page from the pre-installed Demonstration
    		// Space
    		RemotePage page = service.getPage(token, "ds", "Tutorial");
    		String renderedOutput = service.renderContent(token, "ds",
    				page.getId(), page.getContent());
  10. Now run the application and enjoy the rendered HTML content of the page “Tutorial” in the “Demonstration Space” ;)

Tutorial Sources

Please feel free to download the tutorial sources from my Bitbucket repository, fork it there or clone it using Git:

git clone


There’s also a very nice Maven plugin using wsimport if you dont’t like the axis stuff … in this case, take a look at the jaxws-maven-plugin – there’s also a nice blog article from the Sun guys regarding this plugin.

*update* I just wrote an article about the jaxws-maven plugin – enjoy ! :)

*update* If you want to know how to write a SOAP component plugin for Confluence – take a look at this article of mine


Tags: , , , , , , , , , , ,

11 Responses to “How to build a Confluence SOAP client in 5 minutes”

  1. Tweets that mention Some Code » Blog Archive » How to build a Confluence SOAP client in 5 minutes -- Says:

    [...] This post was mentioned on Twitter by some code. some code said: New post: How to build a Confluence SOAP client in 5 minutes [...]

  2. Buss Paris Says:

    Thanks for the great examples!

  3. Buss Paris Says:

    Good information here. Saved me some time!

  4. rudolpho Says:


    i had a few issues to get it running. first i needed axis 1.2.1 to be compatible to the latest confluence (3.5). Using your dependencies ended it several ClassCastException and stuff with the classloader from felix vs. the classloader from tomcat. i’ve got it running with this setup to generate the stubs and not having any dependency inside the pom:









  5. micha kops Says:


    thanks for your input though I was not able to reproduce your problem running the tutorial against my Confluence developer instance (3.5#1910).

  6. Rhys Jones Says:

    Hello Micha,

    I’m using the Confluence SOAP/RPC method renderContent from a remote website and am successfully displaying the returned markup. My quandary is that the page stylesheets returned seem incomplete and as such, my content doesn’t render exactly as it renders from within Confluence. Our goal is to “deliver” the content from within our extranet so it would act as a proxy between the user and the content. (Our extranet governs a complex security structure based on products the customer has purchased so they only can access content for those products) We are transitioning our user documentation to Confluence and want to display it from within our extranet. How can I get the page to render more precisely to match how it renders in Confluence?

    Any help would be greatly appreciated.


  7. micha kops Says:

    Hm sorry .. my only idea atm is to create a custom SOAP endpoint that decorates the existing one and adds the stylesheets that you’re missing. The documentation for creating custom SOAP endpoints as a Confluence plugin can be found here or – as I’ve just remembered – I have also written a short tutorial “How to create a Confluence SOAP component in 5 minutes” :)

  8. Stephanie Says:

    Hi micha kops,
    I’m working on creating a confluence client right now and I’m having trouble getting the import statements in the .java file to work. When I used the mvn axistools:wsdl2java command, instead of getting target/generated-classes I got target/generated-sources. I don’t really know why, but my .java file says stuff like “the import com.atlassian” cannot be resolved” etc.
    Do you have any idea of what might be the cause?

    Thank you in advance!

  9. micha kops Says:

    Hi Stephanie,

    I’ve updated my article and I’ve put the tutorial sources on my bitbucket account – please feel free to reuse them for your project or your own custom SOAP client.



  10. Stephanie Says:

    Hi Micha – the tutorial helped me a lot. Thanks! :)

  11. micha kops Says:

    You’re welcome! I’m glad I could help :)