I'm trying to use a WebService of a payment gateway which uses HTTPS as protocol and i'm using an apache cxf client.
The problem I'm getting timeout to all my requests, but when I use curl to the same WebService I get the response without any problems.
When i log into admin area of the payment gateway, all my tries are there without any errors, so i could say that the problem is somewhere in response.
The stacktrace are down below.
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:510)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:343)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:295)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:75)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at com.sun.proxy.$Proxy1074.authorize(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Caused by: java.net.SocketTimeoutException: Read timed out
at jrockit.net.SocketNativeIO.readBytesPinned(Native Method)
at jrockit.net.SocketNativeIO.socketRead(SocketNativeIO.java:32)
at java.net.SocketInputStream.socketRead0(SocketInputStream.java)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:422)
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:460)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:863)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:820)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at weblogic.net.http.MessageHeader.isHTTP(MessageHeader.java:224)
at weblogic.net.http.MessageHeader.parseHeader(MessageHeader.java:148)
at weblogic.net.http.HttpClient.parseHTTP(HttpClient.java:468)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:401)
at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1005)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1509)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1467)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1375)
You might want to change the receiveTimeout setting from Apache CXF src and replace the existing cxf-rt-transports-http-version.jar in your server.
See the instructions from Wildfly 8.2/undertow read time out
Check if you are behind web proxy,that's why it working in curl but not through through Apache CXF.
Related
In my project I have 2 service providers. For the first one we have SSL certificate installed on server truststore. Recently we implemented the code for the other one for which we kept keystore in server's /security folder.
To invoke the second service we use keystore using
System.setProperty("javax.net.ssl.keyStore",keystore);
System.setProperty("javax.net.ssl.keyStorePassword",keystorePassword);
System.setProperty("javax.net.ssl.keyStoreType","PKCS12");
For laodbalancing we have 2 jetty servers where application is deployed.
Now when we trigger the second service, sometimes it runs successfully from either of servers and sometime fails. We checked with the service provider for the failure. As per the second service provider, the request is picking up certificate for the first service provider and hence failing at second service provider with error code 403. Providing the exception stacktrace as below,
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403null
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:148)
at com.toyota.tme.coc.ereg.client.UtacSoapClient.callTheWebServiceFromFile(UtacSoapClient.java:269)
at com.toyota.tme.coc.ereg.client.UtacSoapClient.sendEreg(UtacSoapClient.java:98)
at com.toyota.tme.coc.ereg.client.EregInvocationClientImpl.sendEregToFrance(EregInvocationClientImpl.java:714)
at com.toyota.tme.coc.ereg.client.EregInvocationClientImpl.invokeIviService(EregInvocationClientImpl.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at com.sun.proxy.$Proxy100.invokeIviService(Unknown Source)
at com.toyota.tme.coc.backend.mdp.SendEregMainframeListener.triggerProcess(SendEregMainframeListener.java:70)
at com.toyota.tme.coc.backend.mdp.MainframeListener.onMessage(MainframeListener.java:64)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:264)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403null
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:257)
at enter code herecom.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:144)
... 22 more
Can someone help with this problem with any clue?
Thanks in advance!
I have an Apache CXF client which calls an SSL Service.
I randomly get this exception when calling a method on the service client:
Caused by: org.apache.cxf.binding.soap.SoapFault: Error getting a ticket for an external resource. Error 0: SSL connection unexpectedly closed
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:114)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:800)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1590)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1488)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1307)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:622)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
... 58 more
Does someone have an idea what the problem could be?
Looks like your client is working properly but receiving an error from the server side. You can enable message logging to see the underlying XML but I would take a look at the logfiles on the server side.
Every time I try to make an API request with my application running on WebSphere, I get this in my logs when trying to log the error:
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://cs28.salesforce.com/...
at sun.reflect.GeneratedConstructorAccessor144.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:58)
at java.lang.reflect.Constructor.newInstance(Constructor.java:542)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1688)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1686)
at java.security.AccessController.doPrivileged(AccessController.java:416)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1684)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1257)
at com.ibm.net.ssl.www2.protocol.https.b.getInputStream(b.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
... 28 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://cs28.salesforce.com/...
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1639)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at com.ibm.net.ssl.www2.protocol.https.b.getResponseCode(b.java:73)
I only get a 500 error when making the API request through websphere. Postman and other services make the request successfully, so I'm pretty stumped. Any thoughts?
I am trying the build a SOAP client to access the National Weather Service NDFD SOAP Service. I'm using Axis2 1.6.2 with code generated with wsdl2java.
Every time I try to retrieve data, I receive a AxisFault saying Read timed out.
I have tried to increase the timeout time to up to 500 s, but all that does is make it wait longer before giving the same error.
Exception in thread "main" org.apache.axis2.AxisFault: [was class java.net.SocketTimeoutException] Read timed out
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at gov.weather.graphical.xml.dwmlgen.wsdl.ndfdxml_wsdl.NdfdXMLStub.fromOM(NdfdXMLStub.java:26499)
at gov.weather.graphical.xml.dwmlgen.wsdl.ndfdxml_wsdl.NdfdXMLStub.nDFDgen(NdfdXMLStub.java:595)
at he.andrew.ndfd.NDFDData.getData(NDFDData.java:47)
at he.andrew.ndfd.NDFDData.main(NDFDData.java:25)
Caused by: java.lang.RuntimeException: [was class java.net.SocketTimeoutException] Read timed out
at com.ctc.wstx.util.ExceptionUtil.throwRuntimeException(ExceptionUtil.java:18)
at com.ctc.wstx.sr.StreamScanner.throwLazyError(StreamScanner.java:731)
at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3657)
at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:809)
at com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamReader.java:679)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getElementText(XMLStreamReaderWrapper.java:100)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getElementText(XMLStreamReaderWrapper.java:100)
at org.apache.axiom.om.impl.llom.SwitchingWrapper.getElementText(SwitchingWrapper.java:936)
at javax.xml.stream.util.StreamReaderDelegate.getElementText(Unknown Source)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getElementText(XMLStreamReaderWrapper.java:100)
at org.apache.axiom.util.stax.debug.XMLStreamReaderValidator.getElementText(XMLStreamReaderValidator.java:75)
at gov.weather.graphical.xml.dwmlgen.wsdl.ndfdxml_wsdl.NdfdXMLStub$NDFDgenResponse$Factory.parse(NdfdXMLStub.java:5612)
at gov.weather.graphical.xml.dwmlgen.wsdl.ndfdxml_wsdl.NdfdXMLStub.fromOM(NdfdXMLStub.java:26353)
... 3 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at org.apache.commons.httpclient.WireLogInputStream.read(WireLogInputStream.java:69)
at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:182)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
at java.io.FilterInputStream.read(Unknown Source)
... more not included
The error seems to be the same as the one here: Exception in thread "main" org.apache.axis2.AxisFault: Read timed out. However, I don't quite understand any of the responses to that question.
One final note. In order to avoid a "411 Error: Length Required", I had to turn off the Chunked option. I'm not sure if this is relevant.
Does anyone know what might be the problem?
I ran into this error on a project, and the root cause was a proxy server setting. I had to modify the proxy to allow the communication to the service I was trying to hit. My code was running as part of a custom application that used its own proxy. So this may also be something to try.
Iam using HTTPClient 4.0 to connect a remote server and transfer file using HTTPS.
When i tried to connect i get the exception "java.net.SocketException: Unconnected sockets not implemented".
Please look at the stack trace
java.net.SocketException: Unconnected sockets not implemented
at java.lang.Throwable.<init>(Throwable.java:196)
at java.lang.Exception.<init>(Exception.java:41)
at java.io.IOException.<init>(IOException.java:40)
at java.net.SocketException.<init>(SocketException.java:29)
at javax.net.SocketFactory.createSocket(SocketFactory.java:2)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(Unknown Source)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(Unknown Source)
at org.apache.commons.httpclient.HttpConnection.open(Unknown Source)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown Source)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown Source)
at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
at co.com.personalsoft.ftpseguro.utilidades.TransmisionHTTP.ejecutarTransmisionHTTP(TransmisionHTTP.java:107)
at co.com.personalsoft.ftpseguro.utilidades.TransmisionFTPNew.ejecutarTransmisionAuto(TransmisionFTPNew.java:483)
at co.com.personalsoft.ftpseguro.utilidades.TransmisionFTPNew.ejecutarTransmision(TransmisionFTPNew.java:1016)
at co.com.personalsoft.ftpautomatico.ConexionThread.run(ConexionThread.java:58)
at java.lang.Thread.run(Thread.java:595)
The same error is found while using HTTP Client 3.1.
My Environment
Application Server : Websphere application server 6.1.0.23
Java : JDK 1.5.0.16
Actually a more complete answer than suppressingfire is
Add com.ibm.ws.admin.client_7.0.0.jar to java build
This solves the java.lang.NoClassDefFoundError: com.ibm.ffdc.Manager error.
Add to setup:
import java.security.Security;
...
Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
This solves the Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory
When I enabled javax.net.debug, I noticed that there was a missing class com.ibm.websphere.com.ibm.websphere.ssl.protocol.SSLSocketFactory.
I was experiencing trouble in unit tests that invoke httpclient. What I ended up doing was to add this line to my TestClass.setUp()
Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");