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

HTTP Code 500 when importing JUnit XML results into Xray REST endpoint


Hello all,


I'm having trouble importing JUnit test results using the Xray REST interface.

The test cases, test plan and a test execution were created beforehand.

For instructions on import I have followed this document: Importing Execution Results into Xray

The code that does this is written in Java and uses Spring Framework to build a REST client:

String encodedKey = Base64.getEncoder().encodeToString((restUser + ":" + pwd).getBytes());

HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Basic " + encodedKey);

String xmlReport = readFile(path + "TEST-template.ExampleClassTest.xml", Charset.forName("UTF-8"));

RestTemplate restTemplate = new RestTemplate();;
HttpEntity<String> entity = new HttpEntity<>(xmlReport, headers);

ResponseEntity<String> response =
+ "raven/1.0/import/execution/junit?projectKey=QSAVTEST&testExecKey=QSAVTEST-170",

As a result, I get the HTTP Code 500 Internal Server Error:

018-12-13 13:31:44,245 DEBUG [main] RestTemplate: Response 500 INTERNAL_SERVER_ERROR
Exception in thread "main" org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 null
    at org.springframework.web.client.HttpServerErrorException.create(
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(
    at org.springframework.web.client.ResponseErrorHandler.handleError(
    at org.springframework.web.client.RestTemplate.handleResponse(
    at org.springframework.web.client.RestTemplate.doExecute(
    at org.springframework.web.client.RestTemplate.execute(
    at template.SpringRestImporter.sendPost(
    at template.SpringRestImporter.main(


Your help will be much appreciated.

Best regards,


1 answer

Hi @Olga ,

I don't know exactly the details of the spring framework; however, we've made recently available an open-source project "xray-code-snippets" with some example for different languages.

You can see here some implementation examples for Java.


In your example, I suspect about the creation of the multipart element that needs to be named "file".



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: Fine Software

Happy New Year, everybody! What better way to kick off 2022 than with a new Marketplace Partner Spotlight ✨ This month, we're getting to know Daniel Franz, co-founder of Fine Software. Fine Software ...

429 views 2 15
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