Hii,

Thanks for the reply but my actual use case is i want to hit the token api
i.e https://localhost:8243/token which requires grant_type username and
password in body in x url www encoded form but my actual payload coming is
username password in my headers so i need to extract username password from
headers and set in body in form of x url www encoded here is my code
attached. But my problem is it is setting in soap envelope but not setting
in message context. Please suggest the solution.

Many thanks

On Thu, 14 Nov 2019, 16:04 Hasunie Adikari, <[email protected]> wrote:

> Hi Priyadarshani,
>
> You have to build the message inside the handleRequest method then you can
> get the message body. Please refer [1] for building the message and refer
> [2] for getting the requestBody.
>
> [1]
> https://github.com/wso2/carbon-apimgt/blob/master/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/SchemaValidator.java#L97
> [2]
> https://github.com/wso2/carbon-apimgt/blob/master/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/security/SchemaValidator.java#L236
>
>
> Regards,
> Hasunie
>
>
> On Tue, Nov 12, 2019 at 3:40 PM Pasindu Jayaweera <[email protected]>
> wrote:
>
>> Hi Priyadarshini,
>>
>> For the  handleRequest method of the customer handler you will be
>> receiving the messageContext as below;
>>
>> public boolean handleRequest(MessageContext messageContext)
>>
>>
>> This messageContext has a method as *getEnvelope* [1] which will give
>> you the message (including header and body).
>>
>> [1] -
>> https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/MessageContext.java#L193
>>
>>
>> Regards,
>>
>> On Mon, Nov 11, 2019 at 5:16 PM Priyadarshini Punjabi <
>> [email protected]> wrote:
>>
>>> Hii,
>>>
>>> how to read request body in custom handler wso2.
>>>
>>> Thanks
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>
>>
>> --
>> *Pasindu Jayaweera *| Senior Software Engineer | WSO2 Inc
>> Mobile: +94 711555785 | Blog: blog.pasindujayaweera.com
>> <http://wso2.com/signature>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>
>
> --
> *Hasunie Adikari*
> Associate Technical Lead
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
> blog http://hasuniea.blogspot.com | https://medium.com/@Hasunie/
> Mobile:+94713095876
>
>

Attachment: App.java
Description: application/ms-java

_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to