Topic
  • 3 replies
  • Latest Post - ‏2012-07-20T12:07:15Z by SystemAdmin
Arco_Synobsys
Arco_Synobsys
224 Posts

Pinned topic Calling REST service from java messes up parameters

‏2011-02-15T14:56:47Z |
Hi there,
I'm having the following REST service definition
Function get_HTM_Task_Input(taskID string in,newInput string in) returns(string) 
                {@GetRest {uriTemplate="{taskID}/input?new={newInput}",requestFormat = JSON,responseFormat = NONE}};

When calling the REST service from a RichUI client (Javascript) the url being send to the server looks like this
"http://localhost/rest/bpm/htm/v1/task/_TKI%3Aa01b012e.aded919.7efdef53.ce39002e/input?new=false"
When calling the same REST service from a EGL program (Java) the url being send to the server looks like this
"http://localhost/rest/bpm/htm/v1/task/_TKI%3Aa01b012e.aded919.7efdef53.ce39002e%2Finput%3Fnew%3Dfalse"

As you can see the parameters of the REST service are messed up, the / sign is translated to %2F, the ? is translated to %3F and the = is translated to %3D.
As you can imagine this isn't the right URL so the service call ends in error.
What's wrong ?

Best regards,
Arco van der Velden
Updated on 2014-03-25T04:41:37Z at 2014-03-25T04:41:37Z by iron-man
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: Calling REST service from java messes up parameters

    ‏2011-02-15T22:15:20Z  
    Hi Arco,

    This looks like a defect, but there may be a work around.
    I found if you change the uriTemplate to a full URL the invocation will succeed.
    so change from
    {uriTemplate="{taskID}/input?new={newInput}",requestFormat = JSON,responseFormat = NONE}}
    to
    {uriTemplate="http://localhost/rest/bpm/htm/v1/task/{taskID}/input?new={newInput}",requestFormat = JSON,responseFormat = NONE}}

    It should work with a the URI you had please open a PMR for this problem.

    regards,
    Joe
  • Arco_Synobsys
    Arco_Synobsys
    224 Posts

    Re: Calling REST service from java messes up parameters

    ‏2011-02-16T11:11:24Z  
    Hi Arco,

    This looks like a defect, but there may be a work around.
    I found if you change the uriTemplate to a full URL the invocation will succeed.
    so change from
    {uriTemplate="{taskID}/input?new={newInput}",requestFormat = JSON,responseFormat = NONE}}
    to
    {uriTemplate="http://localhost/rest/bpm/htm/v1/task/{taskID}/input?new={newInput}",requestFormat = JSON,responseFormat = NONE}}

    It should work with a the URI you had please open a PMR for this problem.

    regards,
    Joe
    Hi Joe,

    Thanks for your response, the workaround is working and I will open a PMR.
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: Calling REST service from java messes up parameters

    ‏2012-07-20T12:07:15Z  
    Hi Joe,

    Thanks for your response, the workaround is working and I will open a PMR.
    Hi,

    I am not able to call EGL Rest service from java.
    Can you Please share the code snippet that you are using to do so?

    Thanks
    Sneha Sharma