Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to call a SOAP Web Service from Jira 7.2.x plugin


Recently I had to develop a program to call a SOAP web service from Jira. 

All I could find is an example of Joe Clark for Jira 5. You can find this answer here:

But this code does not work for Jira 7, that is why I had to write my own code. In this article I will walk you through the code, which I wrote.

You can find my code here:

First of all in Jira 7 the ability to call SOAP services was removed. Before you could use AXIS to call web services, and as far as I understand it was easy, but right now you have to find your own solution.

In this plugin I decided not to write my own SOAP endpoint (maybe in the next article I will create my own one), that is why I took the first SOAP endpoint, I could find in the internet.

I found this one:

Create Jira plugin

You have to create the skeleton for our Jira plugin with the atlas-create-jira-plugin.

Generate classes for the web service

We could manually generate classes for this web service, but let's do it automatically with the wsimport command. You need to go to src/main/java folder in your plugin and type:

wsimport -keep

All necessary files will be generated

Modify your pom.xml file

You should add libraries to call the web service:


Add to the Import-Package tag the following dependency:


Create a rest endpoint to call the web service

You should execute the atlas-create-jira-plugin-module and choose number 14 in the list

Create a handler for you web service

You can call your web service without a handler. But this handler will help you to debug your requests and responses from the service. It will print the raw soap message in the debug level.

The code for the handler is here:

public class MyServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
private static final Logger log = LoggerFactory.getLogger(MyServiceLogHandler.class);

public Set<QName> getHeaders() {
// TODO Auto-generated method stub
return null;

public void close(MessageContext arg0) {
// TODO Auto-generated method stub


public boolean handleFault(SOAPMessageContext arg0) {
SOAPMessage message= arg0.getMessage();
ByteArrayOutputStream out = new ByteArrayOutputStream();

try {
String strMsg = new String(out.toByteArray());
log.debug(String.format("handleFault message: ", strMsg));
} catch (SOAPException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
return false;

public boolean handleMessage(SOAPMessageContext arg0) {
SOAPMessage message= arg0.getMessage();
boolean isOutboundMessage= (Boolean)arg0.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
log.debug("OUTBOUND MESSAGE\n");

log.debug("INBOUND MESSAGE\n");

try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
String strMsg = new String(out.toByteArray());
log.debug(String.format("handleFault message: %s", strMsg));

} catch (SOAPException e) {
} catch (IOException e) {
return true;

Modify your Rest Endpoint

Add this code to your method, which is called from the endpoint, created by you rest :

Dilbert dilbert = new Dilbert();
DilbertSoap ss = dilbert.getDilbertSoap();
BindingProvider bindProv = (BindingProvider) ss;
java.util.List<Handler> handlers = bindProv.getBinding().getHandlerChain();
handlers.add(new MyServiceLogHandler());
String res = ss.todaysDilbert();
return Response.ok(new JaxWsEndpointModel(res)).build();

Run Jira and try to call the web service

type atlas-run in the terminal and after Jira started, open a web browser with the http://localhost:2990/jira url. Login to Jira with admin:admin credentials and enter in the url:


You will get the following result:

Screenshot 2019-02-17 at 22.25.11.png

Do not pay attention that the message looks like an error. This web service returns a response like this:)

Ok. I hope this article helped you!



Thanks for your article. 

Any plans to show how to transfer from axis to axis2, jax etc? 


Gonchik Tsymzhitov

Axis is not in Jira anymore. We could use AXIS before because it was in Jira and it was easy to use. 

I showed an example with jax-ws. I do not think something else is needed to call a web service.

Great example. Thank you. Have you tried this plugin with any recent versions of Jira? It seems to work for me in Jira 7 with Oracle JDK 8, but on Jira 8 with AdoptOpenJDK 8 it gives the exception "java.lang.ClassCastException: com.sun.xml.bind.api.TypeReference cannot be cast to com.sun.xml.bind.api.TypeReference". Maybe some sort of mismatched classloader issue for JAXB?

I have not tried it in Jira 8. I developed an app for a client for Jira 7 and I did not need it yet for Jira 8. When i need it, i will update the tutorial. If you find a way to work it in Jira 8 , please make also a tutorial. This feature is often needed by community.

Hi has anyone managed to run this on Jira 8 so far?


Log in or Sign up to comment
Community showcase
Published in Agile

Master the art of thinking big, working small: A conversation with John Cutler

Hello all! It has been 20 years since the agile manifesto was introduced, and closer to 40 years since software development began moving away from a waterfall-type approach. While many teams have ...

1,448 views 11 27
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you