Mule ESB cxf client config - esb

I'm using mule cxf client to consume web services. How can I change default configuration of the mule cxf client? What I need is to change "Keep-Alive header". Other option is to change http protocol version to set it to 1.0, if that is posible? Thank you.
<cxf:jaxws-client operation="updateParcelDetails"
clientClass="com.pb.pts.service.endpoint.TrackingserviceV10"
port="ParcelTrackingServiceEndpoint_V1_0Port"
wsdlLocation="classpath:wsdl/TrackingV10.wsdl" />

This is controlled by the HTTP transport, not the CXF module.
The HTTP transport doc says:
Attributes of <outbound-endpoint...>
keep-alive | boolean | Controls if the socket connection is kept alive. If set to true, a keep-alive header with the connection timeout specified in the connector will be returned. If set to false, a "Connection: close" header will be returned.
Have you tried it?

Related

WSO2IS 5.3.0 smtp email adapter force tls 1.2

on our instance of wso2 Identity Server we have correctly set up registration confirmation emails and password recovery emails in output-event-adapters.xml in the <adapterConfig type="email"> section .
Our smtp service provider now is going to move to TLS version 1.2 as minimum requirement (lower versions wil be deprecated soon).
Is there a way to force wso2 to use the 1.2 version of the TLS protocol ? I've searched but didn't find anytinhg .
Seems the server reads and passes all the SMTP properties defined in the <IS_HOME>/repository/conf/output-event-adapters.xml file's email adapter configs to the SMTP conncetion.
Therefore, you can try below Java mail properties.
mail.smtp.starttls.enable=true
mail.smtp.ssl.protocols=TLSv1.2
<adapterConfig type="email">
...
<property key="mail.smtp.ssl.protocols">1.2</property>
<property key="mail.smtp.starttls.enable">true</property>
...
</adapterConfig>
If this is Identity Server 5.9.0 or higher, changes should be done in the deployment.toml file.

HAProxy 1.5 - Serving static json file on 504 error

I'm trying to set up HAProxy to server a static JSON file on 504 errors. To test, we've set up the configuration file to timeout after 10 seconds, and to use the errorfile option:
defaults
log global
mode http
retries 3
timeout client 10s
timeout connect 10s
timeout server 10s
option tcplog
balance roundrobin
frontend https
maxconn 2000
bind 0.0.0.0:9000
errorfile 504 /home/user1/test/error.json
acl employee-api-service path_reg /employee/api.*
use_backend servers-employee-api if employee-api-service
backend servers-employee-api
server www.server.com 127.0.0.1:8000
Effectively, I'm trying to serve JSON instead of HTML on a timeout, so the backend service can fail gracefully. However, on testing, we could not get anything, neither HTML or JSON. On looking at the response, it simply says it failed, with no status code. Is my setup correct for errorfile? Does HAProxy 1.5 support this?
According to the documentation of errorfile:
<file> designates a file containing the full HTTP response. It is
recommended to follow the common practice of appending ".http" to
the filename so that people do not confuse the response with HTML
error pages, and to use absolute paths, since files are read
before any chroot is performed.
So, the file should contain a complete HTTP response but you're trying to serve JSON only.
The documentation further says that:
For better HTTP compliance, it is
recommended that all header lines end with CR-LF and not LF alone.
The example configuration, for example,
errorfile 503 /etc/haproxy/errorfiles/503sorry.http
shows the common practice of .http extension for the error file.
You can find samples of some default error files here.
Sample (504.http):
HTTP/1.0 504 Gateway Time-out
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>504 Gateway Time-out</h1>
The server didn't respond in time.
</body></html>
So, in your scenario, 504.http would be like this:
HTTP/1.0 504 Gateway Time-out
Cache-Control: no-cache
Connection: close
Content-Type: application/json
{
"message": "Gateway Timeout"
}
Also, you need to keep the file size under limit i.e. BUFSIZE (8 or 16 KB) as described in the documentation.
There might be some error logs for not serving your JSON file. You might want to look at HAProxy's logs again thoroughly. Just to be sure.

WSO2 Enterprise Integrator Unable to call deployed API

I am completely new to WSO2 and I am facing the problem described below.
After deploying the API (composite application *.car file) I am unable to invoke the services of the defined endpoints from WSO2 ESB.
The REST API I am trying to invoke is found deployed on a local tomcat installation, and is located at:
http://localhost:8080/CustomerInfoRestService/customers/
To retrieve a json customer object I would simply add the customer id, like so:
http://localhost:8080/CustomerInfoRestService/customers/2
All the services operations (Get, POST, PUT, DELETE) are tested and invoked successfully. For testing I used the tool 'PostMan'.
I created an ESB project using the WSO2 Integration Studio.
First I defined an endpoint with a URI Template of:
http://localhost:8080/CustomerInfoRestService/customers/{uri.var.custId}
Then I defined a REST API. The properties of the API Resource are as follows:
URL-Style: URI_Template
URI-Template: /customers/{custId}
Methods: GET
In the In-Sequence I added a log mediator, having:
Log Category: INFO
Log Level: CUSTOM
and I defined its message as:
Property Name: message
Property value type: LITERAL
Property Value: Welcome to Customer Service
Directly next to the log mediator is a 'Send' mediator, and I included the defined endpoint above.
Then I deploy the composite application as: right-click -> Export Composite Application Project.
I include both the API and and the endpoint in the generated *.car file.
Now to invoke an API request, I call the service using 'curl':
curl -v http://localhost:8280/CustomerInfoRestService/customers/2
and I get the response:
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8280 (#0)
> GET /CustomerInfoRestService/customers/2 HTTP/1.1
> Host: localhost:8280
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Thu, 13 Jun 2019 10:09:06 GMT
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
It seems not to be found (404 error)
I followed the WSO2 documentation, specifically the integration tutorial "Sending a Simple Message to a Service" to create this project, for reference it is found at:https://docs.wso2.com/display/EI650/Sending+a+Simple+Message+to+a+Service
Any help is greatly appreciated.
Thanks in advance,
Kind Regards,
This kind of response comes when the API is not deployed or active in the ESB. Did you deploy the car file you created? You did not mention that in your steps. Please make sure that you are able to see the API in the management console (Home -> Service Bus -> API).

502 (BAD GATEWAY) and 504 (GATEWAY TIMEOUT) in Wirecloud

Time ago we set up a PEP proxy to secure the API our widgets are using. All have being working correctly until today, that we are receiving a 502 Bad Gateway error code for every call going through the proxy.
We have checked the requests are reaching our server and it is responsing correctly to them. The parameters added by the proxy (x-nick-name, x-display-name...) are defined correctly too.
We have also checked the requests outside wirecloud and all go well: we get the token properly and use it in the subsequent calls without problem.
We do not know where this error comes from, any ideas?
EDIT 06/11/2015
After Alvaro's new setting we are receiving the following error in the response body:
{
"description": "Connection Error",
"details": "('Connection aborted.', error(104, 'Connection reset by peer'))"
}
EDIT 09/11/15
Today, the code received in the request's response is different: 504 GATEWAY TIMEOUT
{
"description": "Connection Error",
"details": "('Connection aborted.', error(104, 'Connection reset by peer'))"
}
EDIT 16/11/15
Answering to Mr. Alonso's question:
1.- If we request directly to the server, the response is correctly displayed in the application.
2.- Here you can see the logs from the PEP Proxy with the new line added. As you can see the request is redirected correctly but the info is not displayed in the app.
Seems that the problem is in the PEP proxy side.
I've checked using other tools like curl (I obtained the connection details from the server log). Making the same request using curl gives the same result than using WireCloud: connection reset by peer. Also, if I make the request without the X-Auth-Token header, your service responds with an 401 error code. This is important, because it means that there is not a communication problem between the Mashup portal and your server. I don't know why, but the PEP proxy seems to be crashing when making the authenticated request from the Mashup portal (the same command works executing it from my machine).
I suggest you to restart the PEP proxy. If the problem persist, please attach any available info about the crash from the PEP proxy logs.
You can check three things to give us more information:
Try to remove the PEP and send the request directly to your service.
Introduce a new log in PEP to print the headers of the response: line 41 of lib/HTTPClient.js, log.debug("Headers: ", headers);
Try to send a request to the root path (directly to the tomacat or apache)
If not perhaps we can talk in private to check more information

For running Java applications we used Tomcat7 and JBoss in Openshift, Is WebSockets enabled for this ? please help me

var serviceLocation = "ws://kghgk.rhcloud.com:8000/chat?name=frank";
I am getting the response in Browser while hitting that link
Request URL:ws://kghgk.rhcloud.com:8000/chat?name=hlhj
Request Method:GET
Status Code:101 Switching Protocols
Request Headersview source
Connection:Upgrade
Host:kghjk.rhcloud.com:8000
Origin:http://kghjk.rhcloud.com
Sec-WebSocket-Key:EX0+ZalV4q8q+DihpEQSdA==
Sec-WebSocket-Version:13
Upgrade:websocket
(Key3):00:00:00:00:00:00:00:00
Query String Parametersview URL encoded
name:hlhj
Response Headersview source
Connection:Upgrade
Sec-WebSocket-Accept:l8FzoRO13fp8LMa/6iBg6etSzq0=
Upgrade:websocket
(Challenge Response):00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
I am getting null response . please help me to sove this . Is websockets really support for Tomcat7 and JBoss in openshift ?
According to this (https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-jbossews/metadata/manifest.yml) websockets should be enabled. Does this work locally on your own development server?
You might also try using WildFly instead of Tomcat and see if that gives you better results with websockets.