1
votes

I have defined an API Resource in WSO2 ESB like this with GET method:

/sms/{username}/{password}/{src}/{destination}/{body}

Now if I invoke my API through a standard browser like chrome or firefox it works fine and I get response code ok 200

127.x.x.x:8280/sms/username/password/123123123/456456456/سلام

But I can not invoke this API through Postman and it returns Not-Found 404. If I replace 'سلام' with a standard ascii string like 'hello' it works fine and it returns code ok 200:

127.x.x.x:8280/sms/username/password/123123123/456456456/hello

I tried numerous Content-Types in Headers tab of postman including this but it didn't work:

text/html; charset=UTF-8

I also monitored network requests with fiddler. Standard browser send request with this parameters:

Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9

And Postman send request with this parameters:

Content-Type: text/html; charset=UTF-8 cache-control: no-cache Postman-Token: 5ccc574f-54d2-4c5b-ac72-b0f5f5a8e0be User-Agent: PostmanRuntime/7.3.0 Accept: / accept-encoding: gzip, deflate Connection: keep-alive

I use postman v6.4.4

2
@senthalan Yes, it worked, سلام should be encoded to %D8%B3%D9%84%D8%A7%D9%85 could you please write down your comment as an answer? So I can check it as correct answer.Masoud Keshavarz

2 Answers

4
votes

You need to manually encode parts of the URL.

Try this https://stackoverflow.com/a/49964318/9624430

0
votes

I tried this issue with WSO2 ESB 5.0.0. It works for me as you expected through postman.

<api xmlns="http://ws.apache.org/ns/synapse" name="test-api" context="/test">
   <resource methods="GET" uri-template="/value/{val1}">
      <inSequence>
         <log level="full">
            <property name="test" expression="get-property('uri.var.val1')"/>
         </log>
         <payloadFactory media-type="json">
            <format>{ "test": "$1"}</format>
            <args>
               <arg evaluator="xml" expression="get-property('uri.var.val1')"/>
            </args>
         </payloadFactory>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </resource>
</api>

Request: http://localhost:8280/test/value/سلام

Response:

{
    "test": "سلام"
}

Try with WSO2 ESB 5.0.0.