[APIMANAGER-2156] wso2 api manager class mediator request payload updating issue Created: 09/Apr/14 Updated: 14/Apr/14 Resolved: 10/Apr/14 Status: Project: Component/s: Affects Version/s: Fix Version/s: Resolved WSO2 API Manager gateway 1.4.0 Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Environment: Bug Srinivas Reddy Not a bug APIM, ESB Not Specified None Priority: Assignee: Votes: Highest Nuwan Dias 0 Not Specified Not Specified windows 7 64 bit Blocker Severity: Moderate Estimated Complexity: Test cases added: Yes Description I have created a custom mediator and configured as global extension as follows <sequence name="WSO2AM--In" xmlns="http://ws.apache.org/ns/synapse"> <builder> <messageBuilder contentType="application/json" class="org.wso2.carbon.relay.BinaryRelayBuilder"/> <messageBuilder contentType="application/x-www-form-urlencoded" class="org.wso2.carbon.relay.BinaryRelayBuilder"/> </builder> <log level="full"/> <class name="com.XXXXXXX.core.mediator.EncryptAndDecryptMediator"/> <log level="full"/> </sequence> In EncryptAndDecryptMediator class I am decrypting request payload and updating decrypted payload as follows String actualPayload = base64decoding(messageContext.getEnvelope().getBody().getFirstElement().getText()); String decyptedPayload = decypt(actualPayload); messageContext.getEnvelope().getBody().getFirstElement().setText(decyptedPayload); Note : since I am using BinaryRelayBuilder I am doing base64decoding and base64encoding but when I update message payload as above my back end service receiving request as empty, when I am not updating request payload back end service receiving decrypted request payload and end log is showing as below after updating request payload INFO - LogMediator To: /SDE_App/XXXX/1.0, MessageID: urn:uuid:80e8b3c1-27ba-49ef-827d50a613e79a08, Direction request, Envelope: <?xml version='1.0' encoding='utf-8'?> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> <soapenv:Body> <ns:binary xmlns:ns="http//ws.apache.org/commons/ns/payload"> eyJhcHBJZCI6IlNhbXN1bmdQYXlwYWwiLCJ1c2VySWQiOiJnZWV0YSIsInJlZ2lvbiI6IkluZGlhIn0= </ns:binary> </soapenv:Body> </soapenv:Envelope> I am using wso2 api manager 1.4 in windows 7, I am not able to understand what is the issue, any help is highly helpful. Comments Comment by Nuwan Dias [ 10/Apr/14 ] Hi Sirinivas, If you need to read the message within the sequence, you should not be using the BinaryRelayBuilder but instead you should be using the appropriate builder within the builder mediator. For example if the Content-Type of your message is application/json, you should use the JSONBuilder. Ex: <messageBuilder contentType="application/json" class="org.apache.axis2.json.JSONBuilder" formatterClass="org.apache.axis2.json.JSONMessageFormatter"/> For a list of available builders and formatters, please have a look at the Message Builders and Message Formatters section of the axis2.xml file. These type of issues should not be raised on the JiRA but instead you should seek help from the developer mailing list which is <dev@wso2.org>. Or engage with us through a support channel [1]. The JiRA should only be used for things such as reporting bugs, features, etc. [1] - http://wso2.com/support/ Comment by Srinivas Reddy [ 14/Apr/14 ] Hi Nuwan Dias, Thanks for reply, Since I am using decrypted request (decrypting application/json request using AES and sending request) I am using BinaryRelayBuilder, In EncryptAndDecryptMediator class I am decrypting request payload( First doing base64 decode and doing AES decryption) and updating decrypted payload (doing base64 encoding of decrypted payload) but the back end services receiving request as empty. Is there any other thing where can do encryption and decryption using wso2 API manager Thanks & Regards, Srini. Generated at Tue Feb 09 22:11:51 IST 2016 using JIRA 6.0.1#6096sha1:e4a48bd73c6b8a4d99c824976ce5808b4c85857d.