Forum Discussion

allegro's avatar
allegro
New Contributor
11 years ago

JSON body is empty for POST requests for maven plugin

I'm using Open Source SoapUI 5.0
I faced to the next issue:
The request looks like below:
POST http://localhost:9090/jira-web-service-war-3.0.0.0.0-SNAPSHOT/api/jira HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json;charset=UTF-8
Accept: Application/json

{
"issueKey": "ASASNAPIN-590",
"status": "FINISHED",
"description": "SoapUI Test - 'Get queries list'"
}


I'm using soapui-maven-plugin version 5.0 (the same issue on 5.1 as well) to run tests written by the UI.
For windows it works pretty well the plugin sends the next request:

POST http://localhost:7070/jira-web-service-war/api/jira HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json;charset=UTF-8
Accept: Application/json
Content-Length: 116
Host: localhost:7070
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

{
"issueKey": "ASASNAPIN-590",
"status": "FINISHED",
"description": "SoapUI Test - 'Get queries list'"
}

but for Linux there is content-length, but no body:

POST http://localhost:7070/jira-web-service-war/api/jira HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json;charset=UTF-8
Accept: Application/json
Content-Length: 116
Host: localhost:7070
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


It looks like a bug. I've attached both files for Window and Linux with full output for the test step.
Any comments?

2 Replies

  • allegro's avatar
    allegro
    New Contributor
    Hi guys,
    soapui-maven-plugin works Ok for Linux and Windows.
    The only thing which is confusing:
    if TC fails the code below provides different output for Linux and Windows


    for(result in testRunner.getResults()) {
    try {

    fos = new FileOutputStream(resultDirName + "/" +
    testRunner.testCase.testSuite.name + ". " + result.testStep.label + '.txt', true );
    pw = new PrintWriter( fos );

    result.writeTo( pw ); //<-- for Linux there is no JSON body in output.

    pw.close();
    fos.close();
    }
    catch(e) {
    log.error("An error occurred: " + e.toString());
    }


    The second observation is for SoapUI program itself, for Linux the UI doesn't show JSON body for REST request correctly on "Raw" tab.
    The same, there is no JSON body over there after the request has been sent. ( there is no such issue for Windows)