Add timeout to service jboss - jboss

I want to add timeout to service in JBoss.
The problem is that when I run this row for WSDL:
Service service = Service.create(wsdlURL, serviceName);
I get timeout from WSDL like this:
org.jboss.ws.core.WSTimeoutException: Timeout after: 30000ms
I try to add timeout to my service like:
((BindingProvider)service).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 500);
// ((BindingProvider)service).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", 500);
but I have exception.
What is the reason for that?

Try with javax.xml.ws.client.connectionTimeout and javax.xml.ws.client.receiveTimeout.
Eg:
//Set timeout until a connection is established
((BindingProvider)port).getRequestContext().put("javax.xml.ws.client.connectionTimeout", "6000");
//Set timeout until the response is received
((BindingProvider) port).getRequestContext().put("javax.xml.ws.client.receiveTimeout", "1000");
Ref: Develop a JAX-WS Client Application

Related

Set request timeout at connection pool level using hackney and HTTPoison

I am using httpoison which uses Hackney under the hood to make HTTP requests.
By default, Hackney uses a default connection pool which is created with - connection timeout - 8000 ms, request timeout - 5000 ms. These numbers are too small for our project.
I have created a connection pool with different connection timeouts.
:hackney_pool.child_spec(:connection_pool, [timeout: 15_000, max_connections: 50])
and setting request timeout for each request like this
HTTPoison.get("httpbin.org/get", [], hackney: [recv_timeout: 15_000])
This does not look efficient to me as I need to put this timeout on every request.
I want to do set the recv_timeout at pool level eg:
:hackney_pool.child_spec(:connection_pool, [timeout: 15_000, recv_timeout: 15_000, max_connections: 50])
so when it creates a new connection, it can set the timeout at the connection level. My doubt is Can I specify the request timeout at the connection level? or is it just a request level timeout and HTTP does not support it at the connection level?.

spring cloud gateway throws Load balancer does not have available server for client

Eureka + Gateway + BackendServerA + BackendServerB. After BackendServerB is down, it throws exception:
com.netflix.zuul.exception.ZuulException: Forwarding error
Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: service-B
Event after I manually reboot serverB, it still throws the same error with a 500 http code returned. However, if I turn on the other 3 servers before Gateway, it works properly. I used application.properties file to configure routes.

Understanding HTTP 504 Result from Spray Web Service

Given:
client <-- HTTP --> spray web service <-- HTTP --> other web service
The client receives the following HTTP status code and entity body when hitting the spray web service:
504 Gateway Timeout - Empty
Per this answer, my understanding is that the spray web service is not receiving a timely response from the other web service, and thus sending an HTTP 504 to the client.
Assuming that's reasonable, per https://github.com/spray/spray/blob/master/spray-http/src/main/scala/spray/http/StatusCode.scala#L158, I'm guessing that one of these server config values is responsible for the 504 in the spray web service's HTTP response to the client.
What config or implicit would cause the spray web service to reply with a 504 to the client?
I think you are using the default Spray timeouts and perhaps you will need to increase them. If this is the case, there are 2 values you will have to configure to increase the timeouts.
idle-timeout: Time you can have an idle connection to your server before it is disconnected (default 60s).
request-timeout: Time a request from your client (from your server to another) can be idle before it timesout (default 20s).
The first value must be always higher than the second, as the idle-timeout will make pointless the connections from your request client.
So just overwrite your configuration in your application.conf like this:
spray.can {
server {
idle-timeout = 120 s
request-timeout = 20 s
}
}

smack is connecting to ejabberd server

Here is my smack code to connect ejabberd server
XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();
builder.setUsernameAndPassword("admin#manish-lenovo-g510", "admin");
builder.setServiceName("manish-lenovo-g510");
builder.setHost("192.168.1.2");
builder.setPort(5280);
XMPPTCPConnectionConfiguration build = builder.build();
AbstractXMPPConnection conn1 = new XMPPTCPConnection(build);
conn1.connect();
I am getting this error:
Exception in thread "main" org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: No filter used or filter was 'null'.
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:106)
at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:85)
at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoint.java:253)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(SynchronizationPoint.java:146)
at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWaitOrThrow(SynchronizationPoint.java:125)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:837)
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:365)
if i open admin interface of ejabberd its opening so Why this code is not working. One more thing how to find the service name as i guess that might be the issue as i dont know the service name, i have given it randomly.
I think port should be the standard XMPP port which is 5222. 5280 is the port for web admin, which speaks HTTP, not XMPP.

Fiddler Failed to read HTTP request from new client socket

I use Apache common HttpClient to send a request, and want to use fidder moniter the process. following is my setting:
Object myHost = "127.0.0.1";
sysProperties.put("socksProxyHost", myHost);
Object myPort = "8888";
sysProperties.put("socksProxyPort", myPort);
But fiddler show me a logs:
10:44:16:6236 [Fiddler] Failed to read HTTP request from (javaw:1408) new client socket, port 49784.
10:45:17:1321 [Fiddler] Failed to read HTTP request from (javaw:1408) new client socket, port 49785.
10:46:17:6395 [Fiddler] Failed to read HTTP request from (javaw:1408) new client socket, port 49802.
10:47:18:1460 [Fiddler] Failed to read HTTP request from (javaw:1408) new client socket, port 49811.
Fiddler isn't a SOCKS proxy, so when you try to use it as one, you'll find that it doesn't work.