Hi Damith,

The ESB cannot dispatch the request to a matching resource if you have any
special characters (in your case "@") in the URL path (URI parameter). So,
if the URL path contains any special characters and if you try to invoke a
particular resource, the response will be a "404" not found.

To overcome this problem, you can follow either one ...

*URL-encode the email address and send it*

For example:

d...@demo.com will become as demo%40demo.com

So your URL will be as

http://localhost:8290/root/getUserEmail/demo%40demo.com
<http://localhost:8290/root/getUserEmail/damithsj%40gmail.com>


OR


*Allow ESB [EI] to accept special characters in URL path*

By changing your current uri-template as follow
<resource methods="GET" uri-template="/getUserEmail/{+email}">

{+email} annotation will enable the ESB [EI] to accept special characters
in the URL path.

Hope this solves your query.

You can find more information about special characters here[1].
You can find more information on handling special characters in URL with
WSO2 ESB here[2].

[1]:
https://secure.n-able.com/webhelp/NC_9-1-0_SO_en/Content/SA_docs/API_Level_Integration/API_Integration_URLEncoding.html
[2]:
https://dzone.com/articles/handling-special-characters-in-urls-with-wso2-esb

Thanks & Regards,
*Kathirgamasegaran Athiththan *| Software Engineer | WSO2 Inc.
(m) +94774922931 | (e) athitht...@wso2.com

<http://wso2.com/signature>


On Mon, Jul 8, 2019 at 9:26 PM Damith Jinasena <damit...@gmail.com> wrote:

> Hi All,
>
> I'm trying to create a simple REST api to get user details providing the
> email.
> But once I add an email (with @ sign), REST API returns with 404 error.
>
> Eg:
> http://localhost:8290/root/getUserEmail/damithsj works fine
> http://localhost:8290/root/getUserEmail/damit...@gmail.com   404 error :|
>
> I'm playing with   Integration Studio 6.5.0
>
> Can you point me in the right direction?
>
> My sample API is given as below.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <api context="/root" name="testemail" xmlns="
> http://ws.apache.org/ns/synapse";>
>     <resource methods="GET" uri-template="/getUserEmail/{email}">
>         <inSequence>
>             <property description="reademail"
> expression="get-property('uri.var.email')" name="email" scope="default"
> type="STRING"/>
>             <log description="log" level="custom">
>                 <property expression="$ctx:email" name="email"/>
>             </log>
>             <respond description="respond"/>
>         </inSequence>
>         <outSequence/>
>         <faultSequence/>
>     </resource>
> </api>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to