我试图以编程方式运行我的SoapUI项目。
该项目在SoapUI用户界面版本中运行良好:OSX的5.2.1
我有一个gradle / grails构建,在尝试解压缩第一个响应时会出现异常:
java.io.IOException: Decompression of response failed
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpMethodSupport.getResponseBody(HttpMethodSupport.java:264)
at com.eviware.soapui.impl.wsdl.submit.transports.http.support.methods.ExtendedGetMethod.getResponseBody(ExtendedGetMethod.java:154)
at com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpResponse.<init>(BaseHttpResponse.java:85)
at com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse.<init>(SinglePartHttpResponse.java:44)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.httpRequest(HttpPackagingResponseFilter.java:81)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.afterAbstractHttpResponse(HttpPackagingResponseFilter.java:52)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.afterRequest(AbstractRequestFilter.java:64)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:265)
build.gradle在依赖项中包含了这个:
compile ("com.smartbear.soapui:soapui:5.2.1") {
exclude module: 'looks'
exclude module: 'binding'
exclude module: 'cajo'
exclude group: 'org.codehaus.groovy'
exclude group: 'org.apache.oltu.oauth2.client'
}
调用SoapUi的代码:
def uploadViaSoapUi() {
SoapUITestCaseRunner runner = new SoapUITestCaseRunner( "SoapUI " + SoapUI.SOAPUI_VERSION
+ " Auto invoice upload" );
runner.setProjectFile( 'myproject-soapui-project.xml' );
runner.setEndpoint( 'https://my-server.com' );
runner.setTestSuite( 'Upload Invoice' );
runner.setTestCase( 'Good Invoice' );
runner.run();
}
我做错了什么?
答案 0 :(得分:1)
从项目构建路径中删除UnNecessory依赖项。
对我来说,从pom.xml中删除以下依赖项解决了问题
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
答案 1 :(得分:0)
在测试用例的开头添加一个这样的Groovy步骤:
import com.eviware.soapui.SoapUI;
import com.eviware.soapui.settings.HttpSettings;
//Change value what is needed for you true or false
boolean enableCompressedResponse = true;
SoapUI.getSettings().setBoolean(HttpSettings.RESPONSE_COMPRESSION, enableCompressedResponse);