where can I set up character encoding in WSO2 EI - wso2

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"/>

Related

How to log request headers within script mediator in Wso2 API Manager 3.2?

I am trying to get all transport headers used when calling a specific API and log that for debugging, since we do not know what the name of the headers will be I want to log them all.
I know this can be done via a class mediator as well as by enabling wire logs but I am looking for an option to achieve this without having to do either of those.
I have tried using script mediator and then using: mc.getProperty("org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS") to fetch them from message context but it just returns null.
Any suggestions?
You are trying to get a property with the name "org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS" from the default Context, hence it's returning null. You can't really access TRANSPORT_HEADERS from the Axis2Context within a ScriptMediator. Your best option is to write a class mediator.
Use get-property from the transport layer.
Only you need to know the name of the variables.
<log level="headers" category="INFO">
<property name="inicio" value="------ begin -------"/>
<property name="X_Teste_FOS" expression="get-property('transport','X-Test-FOS')"/>
<property name="inicio" value="------ end -------"/>
</log>

WSO2: Add IBM MQ Correllation ID to message header

How do you add the IBM MQ Correlation ID header to a message in WSO2 Integrator?
I have a scenario where I receive a message from MQ, transform the message using a few mediators and calls to backend services, and need to reply with the transformed message to another (MQ) queue using WSO2 Integrator (version 6.1.1). The client receiving the message is expecting to find the same Correlation ID in my reply as in his original message.
IBM tells me the property is this one:
The CorrelationId to be included in the MQMD of a message when put on
a queue.
Defined in: MQMessage class
Data Type: String of 24 characters
Syntax: To get: correlid$ = MQMessage.CorrelationId To set: MQMessage.CorrelationId = correlid$
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q034650_.htm
It turns out it was an easy solution. The JMS_COORELATION_ID property must be set specifically in the axis2 scope.
So while this works:
<property name="JMS_COORELATION_ID" value="MyCoorelationId" scope="axis2" xmlns:ns="http://org.apache.synapse/xsd"/>
Using any other scope, such as default or transport, does not:
<property name="JMS_COORELATION_ID" value="MyCoorelationId" scope="transport" xmlns:ns="http://org.apache.synapse/xsd"/>
<property name="JMS_COORELATION_ID" value="MyCoorelationId" scope="default" xmlns:ns="http://org.apache.synapse/xsd"/>
Unfortunately the WSO2 documentation is dreadful and does not mention that other scopes do not work. Hope this saves someone time in the future.

How correctly make sequence for WSO2 API? It's breaking email send

I create simple api with URI-template
/my_context/{param1}?b={param2}
I created simple sequence for sending email message to endpoint with address
mailto:user#gmail.com
I opened link
/api/my_context/123?b=222
And found in log messages:
Send TO: user#gmail.com/my_context/123?b=222
Incorrect Address.
Why WSO2 ESB append uri to email address?
Removing REST_URL_POSTFIX property like this will change that behavior.
<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>

Capturing WSO2 DSS Service Errors in WSO2 ESB Proxy Service

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

WSO2 ESB 4.9 - fire and forgot is not working with OUT_ONLY

I am newbie to WSO2 ESB, so far everything is OK.
I started exploring fire and forgot feature, looks like this can be used as below to invoke async calls to end points.
<property name="CHANNEL_COD" value="999"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property name="OUT_ONLY" value="true"/>
But when tested the API with above code, still ESB invoking the end point in syncronous. Tried this approach with call and send mediators.
Would anybody please help me is there any link I am missing here.
With ESB 4.8.1 :
If ClientApiNonBlocking property is not set, send mediator should be asynchronous.
Because of FORCE_SC_ACCEPTED, 202 http status code will be sended back at the end of IN mediation (ie : the message has been delivered to your endpoint, without waiting for the response)
If it takes several seconds to send the message to the endpoint, the caller will receive 202 status code AFTER that.
If you want this status code to be sent ASAP, you can use clone mediator and move send mediator inside clone's target