Capturing WSO2 DSS Service Errors in WSO2 ESB Proxy Service - wso2

Good Day!
I have a WSO2 ESB proxy service which is calling WSO2 DSS Service. It is inserting the data to mysql table. it is working as expected. but if there is any issue in the DSS Service, I am getting faults with different soap response formats. like
if the service is inactive or stopped, then getting response like
<soapenv:Body><soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">.......
if the service is facing issue while inserting the data, then getting response like
<soapenv:Body><axis2ns134:DataServiceFault xmlns:axis2ns134="http://ws.wso2.org/dataservice"><axis2ns134:current_params......
and some other cases getting different responses.
but is ESB, those errors are not capturing and not firing "faultsequence" even I explicitly set the below property
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>
Can you please guide me how to handle/catch those errors in ESB Proxy?
Thanks,
Vinoth

see if this documentation helps you.
https://docs.wso2.com/display/ESB490/Fault+Mediator
https://docs.wso2.com/display/ESB490/Error+Handling
Att;
Vitor Darela

Related

WSO2 error code 500 when invoking the API at the first time

I'm doing a stress test on an API deployed in wso2 integrator server with a high number of requests. Every stress test session. I always get the first response as fault response with an
error code 500 (internal server error)
And the remaining responses are fine.
I noticed that if the session is expired and if I want to send a request with this session id, above problem is produced.
I'm using wso2ei 6.5.0 as my server application version.
Can anyone help me please to avoid this message?
Try adding the following properties to the API sequence.
<property name="NO_KEEPALIVE" value="true" scope="axis2"/>
<property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
This will make sure that connections are properly closed in-between the test sessions.

In wso2 esb how to read endpoint from a file

In wso2 esb what is the best practice for Endpoint maintenance. From some article I got to know that we can read from file So, if this the best approach how achieve this one.
In a scenario where the endpoint is saved as a file within the carbon registry (You can even upload the file via management console or can use WSO2 EI Tooling to create an endpoint template), we can read the content of the endpoint as follows.
Add the endpoint registry resource.
Log the endpoint content using the following synapse configuration. (Can even retrieve specific attributes within the endpoint using their xpath expressions)
<log level="custom">
<property name="Endpoint Content:" expression="$ctx:endpointFile//*"/>
<property name="Endpoint URL:" expression="$ctx:endpointFile//*[local-name() = 'address'][1]/#uri"/>
</log>
You can see the logged endpoint content as below.
There are 3 ways to Endpoint Maintenance.
Using ESB Tooling
From Command Line
Using a Script
More details can be found in WSO2 Documentation.

where can I set up character encoding in WSO2 EI

I'm new to WSO2,
In the WSO2 ESB profile, I tried to send a message like this:
{"name":"中国"}
but after proxy service and in my back-end service it printed:
{"name":"???"}
it also appeared both in API, when I debug the api, I can see the payload as already unreadable.
So I think I must set up character encoding before the payload coming in. But where can I do this?
Can you help me?
Can you try adding the following (as suggested in this blog):
<property name="CHARACTER_SET_ENCODING" value="UTF-8" scope="axis2" type="STRING"/>

Unable to set the User-Agent as transport Header in WSO2 EI 6.1

I am trying to invoke an external REST service from WSO2 EI 6.1.
This REST service needs the transport header User-Agent to be set.
I used the below code to set the transport value but looks like WSO2 does not recognize it.
<header name="User-Agent" scope="transport" value="3PPUser/5.0/1.0"/>
I even tried changing the http.user.agent.preserve to true at passthru-http.properties, but no successs.
Not sure if I am missing something. Please help!
Thanks in advance !!

How convert soap web service to Rest in wso2 ESB

I need to convert my existing SOAP web service to a REST webservice by using WSO2 ESB. I tried with the given samples in the Documentation successfully. And also I created a transformer proxy and set the end point as my existing WSDL url. In my case I'm getting the response as SOAP. SO how can I change that response into Json in the created proxy? I tried with the outsequences a lot. but coudnt make it success. Can anyone tell me the exact steps to do this.
I riffered [enter link description here][1]
[1]: http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL as web service.
In your REST API (see the example link given in Samisa's answer above) use the following property in out sequence to convert the message type to JSON.
<property name="messageType" scope="axis2" value="application/json"/>