在groovy-wslite中更新的SOAP消息(在GGTS中为dev模式)给出了连接重置消息,并且在SOAPUI 5.5.0中使用相同的消息是可行的。背景信息:我们的数据库最近从内部迁移到了在线,提供程序从http更改为https,令牌的使用,从http更改为https,我们正在使用Java(TM)SE运行时环境(内部版本1.7.0_71-b14 )和grails 2.3.11。
我尝试使用https://github.com/jwagenleitner/groovy-wslite中所示的不同语法,但没有结果。其他人提到了如何在Java 7中激活TLSv1.2。
getconnectorurl = 'https://123456.soap.afas.online/profitservices/appconnectorget.asmx'
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
String soapRequest = """
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Afas.Profit.Services">
<soap:Header/>
<soap:Body>
<urn:GetData>
<urn:token><![CDATA[<token><version>1</version><data>${tokenString}</data></token>]]></urn:token>
<urn:connectorId>${function}</urn:connectorId>
<urn:filtersXml/>
<urn:skip>0</urn:skip>
<urn:take>20</urn:take>
</urn:GetData>
</soap:Body>
</soap:Envelope>"""
log.info("soapRequest=${soapRequest}");
try {
// SOAPResponse response = client.send(SOAPAction: "urn:Afas.Profit.Services", SOAPVersion.V1_1, connectTimeout:7000, readTimeout:9000,useCaches:false, followRedirects:true, sslTrustAllCerts:true,soapRequest);
// SOAPResponse response = client.send(SOAPAction: 'urn:Afas.Profit.Services/GetData', soapRequest);
SOAPResponse response = client.send(soapRequest);
SOAPUI返回预期的20条记录,wslite返回连接重置消息,wireshark显示Client Hello,然后是Server Hello,等等,但是wslite在Client Hello之后停止。提供程序使用TLSv1.2。所以我添加了System.setProperty(...),wireshark日志显示了TLSv1.2。
grails日志 sce.message =连接重置 2019-07-01 10:53:11,595 [INFO] grails.app.services.afas.AfasDataCollectorService-sce = wslite.soap.SOAPClientException:连接重置 2019-07-01 10:53:11,597 [INFO] grails.app.services.afas.AfasDataCollectorService-sce.dump = https://123456.soap.afas.online/profitservices/appconnectorget.asmx标头= {Content-Type =文本/ XML; charset = UTF-8} readTimeout = 0 connectTimeout = 0 method = POST> response = null detailMessage =连接重置原因= java.net.SocketException:连接重置stackTrace = [] rejectedExceptions = []>
SOAPUI日志 Mon Jul 01 09:49:13 CEST 2019:DEBUG:>>“ POST /profitservices/appconnectorget.asmx HTTP / 1.1 [\ r] [\ n]” Mon Jul 01 09:49:13 CEST 2019:DEBUG:>>“接受编码:gzip,deflate [\ r] [\ n]” Mon Jul 01 09:49:13 CEST 2019:DEBUG:>>“内容类型:text / xml; charset = UTF-8 [\ r] [\ n]” Mon Jul 01 09:49:13 CEST 2019:DEBUG:>>“ SOAPAction:” urn:Afas.Profit.Services/GetData“ [\ r] [\ n]” Mon Jul 01 09:49:13 CEST 2019:DEBUG:>>“内容长度:531 [\ r] [\ n]” Mon Jul 01 09:49:13 CEST 2019:DEBUG:>>“主持人:086312.soap.afas.online [\ r] [\ n]” 2019年7月1日星期一07:49:13 CEST:调试:>>“连接:保持活动[\ r] [\ n]” Mon Jul 01 09:49:13 CEST 2019:DEBUG:>>“ User-Agent:Apache-HttpClient / 4.1.1(java 1.5)[\ r] [\ n]”
更新:grails -Dgrails.full.stacktrace = true在开发模式下运行应用程序,但是app_stacktrace.log保持为空。
更新:添加了printStackTrace()
| Error wslite.soap.SOAPClientException: Connection reset
| Error at sun.reflect.GeneratedConstructorAccessor145.newInstance(Unknown Source)
| Error at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
| Error at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
| Error at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1002)
| Error at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
| Error at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:202)
| Error at wslite.soap.SOAPClient.send(SOAPClient.groovy:61)
| Error at wslite.soap.SOAPClient$send$1.callCurrent(Unknown Source)
| Error at wslite.soap.SOAPClient.send(SOAPClient.groovy:48)
| Error at sun.reflect.GeneratedMethodAccessor359.invoke(Unknown Source)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:606)
| Error at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
| Error at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
| Error at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
| Error at wslite.soap.SOAPClient.send(SOAPClient.groovy)
| Error at wslite.soap.SOAPClient$send.call(Unknown Source)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
| Error at afas.AfasDataCollectorService$$ERUyIxt2.getXMLData(AfasDataCollectorService.groovy:74)
| Error at afas.AfasDataCollectorService$$DRUyIxt2.getXMLData(Unknown Source)
| Error at afas.AfasDataCollectorService.getXMLData(AfasDataCollectorService.groovy)
| Error at afas.AfasDataCollectorService$$FastClassBySpringCGLIB$$c886fe00.invoke(<generated>)
| Error at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
| Error at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700)
| Error at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
| Error at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
| Error at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
| Error at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
| Error at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
| Error at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633)
| Error at afas.AfasDataCollectorService$$EnhancerBySpringCGLIB$$c01f8292.getXMLData(<generated>)
| Error at afas.AfasDataCollectorService$getXMLData.call(Unknown Source)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error at afas.AfasDataCollectorService$getXMLData.call(Unknown Source)
| Error at afas.EmployeeService.runImport(EmployeeService.groovy:22)
| Error at afas.EmployeeService$runImport.call(Unknown Source)
| Error at afas.ImportAfasEmployeesJob.execute(ImportAfasEmployeesJob.groovy:20)
| Error at sun.reflect.GeneratedMethodAccessor358.invoke(Unknown Source)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:606)
| Error at org.springsource.loaded.ri.OriginalClassInvoker.invoke(OriginalClassInvoker.java:47)
| Error at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1299)
| Error at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:104)
| Error at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
| Error at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
| Error Caused by: java.net.SocketException: Connection reset
| Error at sun.reflect.GeneratedConstructorAccessor133.newInstance(Unknown Source)
| Error at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
| Error at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
| Error at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
| Error at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
| Error at java.security.AccessController.doPrivileged(Native Method)
| Error at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
| Error at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
| Error at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
| Error at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
| Error at sun.reflect.GeneratedMethodAccessor375.invoke(Unknown Source)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:606)
| Error at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
| Error at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
| Error at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
| Error at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1725)
| Error at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1140)
| Error at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3461)
| Error at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1152)
| Error at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:174)
| Error at org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.callGetProperty(PojoMetaClassGetPropertySite.java:41)
| Error at wslite.http.HTTPClient.buildResponse(HTTPClient.groovy:152)
| Error at wslite.http.HTTPClient.this$2$buildResponse(HTTPClient.groovy)
| Error at wslite.http.HTTPClient$this$2$buildResponse$8.callCurrent(Unknown Source)
| Error at wslite.http.HTTPClient.execute(HTTPClient.groovy:60)
| Error at wslite.http.HTTPClient$execute.call(Unknown Source)
| Error at wslite.soap.SOAPClient.send(SOAPClient.groovy:57)
| Error ... 41 more
| Error Caused by: java.net.SocketException: Connection reset
| Error at java.net.SocketInputStream.read(SocketInputStream.java:196)
| Error at java.net.SocketInputStream.read(SocketInputStream.java:122)
| Error at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
| Error at sun.security.ssl.InputRecord.read(InputRecord.java:480)
| Error at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
| Error at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
| Error at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
| Error at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
| Error at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
| Error at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
| Error at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
| Error at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2678)
| Error at java.net.URLConnection.getContentEncoding(URLConnection.java:533)
| Error at sun.net.www.protocol.https.HttpsURLConnectionImpl.getContentEncoding(HttpsURLConnectionImpl.java:410)
| Error at sun.reflect.GeneratedMethodAccessor373.invoke(Unknown Source)
| Error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error at java.lang.reflect.Method.invoke(Method.java:606)
| Error at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
| Error at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
| Error at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
| Error at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1725)
| Error at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1140)
| Error at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3461)
| Error at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1152)
| Error at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:174)
| Error at org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.callGetProperty(PojoMetaClassGetPropertySite.java:41)
| Error at wslite.http.HTTPClient.buildResponse(HTTPClient.groovy:151)
| Error ... 46 more