WSO2 ESB 4.8.1 remove charset=UTF-8 from request - wso2-esb

In WSO2 ESB 4.8.1, I recived a request at Proxy Service with following header:
Content-Type: text/xml;charset=UTF-8
When ESB sends the request to endpoint charset field has been removed.
How can I avoid that ESB removes that field?

I have to put next statements before send mediador:
<property name="messageType" value="text/xml;charset=UTF-8" scope="axis2"/>

Related

Enable WS-Addressing in Mulesoft Web service consumer

How to enable WS-Addressing in Web service Consumer of Mulesoft.
When I search for WS-Addressing in mulesoft. It points to CXF. However the docs point that it's recommended to use web service consumer rather than CXF.
So is there any way to enable WS-Addressing. SoapAction is added into the WSDL
POST /esi2/esi-gateway/v2/common/v1 HTTP/1.1
SOAPAction: "http://www.macquarie.com/...."
Host: www.macquarie.com
User-Agent: AHC/1.0
Connection: keep-alive
Accept: */*
Content-Type: text/xml; charset=UTF-8
Content-Length: 1453
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-2004
...................
When Tested in SOAP UI I can find WS-A with all the details filled. How can i get a similar stuff in Mulesoft
Note :- This is the official answer. And it works. Fix the dummy web address in TO, Action and messageID.
Please add the following before webservice consumer . you should be set to go
<set-property propertyName="soap.to" value="<wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.asdfadsf.com/esi/common/v1</wsa:To>" doc:name="Soap.To"/>
<set-property propertyName="soap.Action" value="<wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.xyzdadadf.com/esi/common/1.0/getAuthenticationExpiryRequest</wsa:Action>" doc:name="soap.action"/>
<set-property propertyName="soap.messageID" value="<wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">urn:entity-name:version:1</wsa:MessageID>" doc:name="soap.messageID"/>
I post this in the form for larger community help.

SET X-AUTH-TOKEN in WSO2 ESB

We need to set the http header property X-Auth-Token in ESB before sending it to endpoint. The endpoint authenticates this token.
When we X-Auth-Token in header property it's not working.
Can you suggest the way to set the X-Auth-Token property in http header in WSO2
You use the following config to do this. Make sure the scope is set to transport.
<property name="X-Auth-Token" scope="transport" value="XXXXX" />

Wso2esb rest to soap - uri-template is appended to receiving esb

I have two wso2esb instances:
1) receives a rest uri-template and sends it as a soap request.
Example request: http://myipadd:8280/restcontext/mypath
2) receives and process the soap request from #1.
When I log the request from #1, it logs that my header "To: /services/MyService" is set correctly as expected. But when I receive it from #2, it appends the path: "To: /services/MyService/mypath".
Now, my proxy service is not able to resolve this.
Use this before sending soap request to remove your REST_URL_POSTFIX:
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>

WSO2 ESB REST Post request empty response

I'm trying to call test Rest Api via Post request but ESB returns always empty response. For GET request response is sent correctly by ESB.
I have tried almost everything but still cannot make this work. My ultimate goal is to store message sent by client via Post request (large requests) and sent XML structured response to user that message is queued. Here's simple example what I have tried but for Post request empty response is sent by ESB.
<inSequence xmlns="http://ws.apache.org/ns/synapse">
<log>
<property name="text" value="IN Sequence"></property>
</log>
<header name="To" scope="default" action="remove"></header>
<property name="RESPONSE" value="true" scope="default" type="STRING"></property>
<payloadFactory media-type="xml">
<format>
<response xmlns="">Hello world</response>
</format>
</payloadFactory>
<send></send>
</inSequence>
Is this BUG In WSO2 ESB 4.0.8 or am I missing something ?
Thanks,
Kari
This is now resolved. Actually problem was that in Rest client I didn't specify Content-type. After adding Content-Type application/xml -header. The XML response worked fine for POST request. For GET Request this was working all the time.

Access-Control Origin HTTP header on WSO2 ESB Out

How do I set custom HTTP headers on an ESB proxy service Out Sequence? I'm trying to set "Access-Control-Allow-Origin" to allow my javascript/html front-end page to be able to GET the XML that is provided by this service. I also need to add a Cache-Control.
If there is a way to do this directly on my WSO2 Data Services Server (DSS), that would be preferable as it would avoid adding an ESB server to my process. According to this forum post from about a year ago, it's not possible: http://wso2.org/forum/thread/13991
I've tried it several ways, but looking at fiddler, the header is unchanged:
HTTP/1.1 200 OK
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 637
Date: Wed, 28 Mar 2012 20:58:31 GMT
Server: WSO2 Carbon Server
I'm somewhat new with WSO2 servers (more of a front-end dev), so the answer could be right in front of me.
You can do this by adding a Property mediator to the out-sequence. Once you set the property with the transport scope there, it will be added to the transport header of the out going message from the ESB.
This property mediator worked for me:
<property name="Access-Control-Allow-Origin" value="*" scope="transport" type="STRING"></property>
It allows access from any origin.
-Kari