Skip to Content

Getting error message while calling Odata service with filter expression from SCP XSJS

Hello

I have one Odata service with request URI as below:-

/sap/opu/odata/sap/ZGW_IOT_DELIVERY_DETAILS_SRV/ZES_DELIVERY_DETAILS?$filter=Lfart eq 'LF' and Plant eq 'ZFG1'

Now when i call this URI from gateway client its giving me expected result. Now my purpose is to call this odata service from my XSJS through SCP cloud. I have called gateway service from xsjs successfully for other Odata service without filter expression. But when i am using filter to call this service from xsjs getting this error message :-

jsn Invalid request received by HTTP proxy: java.lang.IllegalArgumentException: invalid version format: = LFART EQ 'LF' AND PLANT EQ 'ZFG1'?$FORMAT=JSON HTTP/1.1

Here is the request message i have built in xsjs :-

request = new $.web.WebRequest($.net.http.GET,"/ZES_DELIVERY_DETAILS?$filter = Lfart eq '" + lfart + "' and Plant eq '" + plant + "'?$format=json");

Any idea why using filter I am getting this error message?

Thanks,

Sunit

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Jun 20 at 06:21 PM

    Hi chaithra lakshmi

    Read the comments about encodeURI in this exact same thread entered on May 01 at 12:05 AM. If it doesn't help you should open a new thread as mentioned by Ankit.

    Regards,
    Ivan

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 17, 2017 at 05:23 AM

    Seems like Gateway oData is ignoring the incorrect format but SCP cloud's version is not.

    You URL is bit wrong. Try as below

    request = new $.web.WebRequest($.net.http.GET,"/ZES_DELIVERY_DETAILS?$filter = Lfart eq '" + lfart + "' and Plant eq '" + plant + "'&$format=json");

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 01 at 12:05 AM

    Hi,

    Maybe the problem is the spaces in the URL try this:

    var uriEncoded = encodeURI("/ZES_DELIVERY_DETAILS?$filter = Lfart eq '" + lfart + "' and Plant eq '" + plant + "'?$format=json");

    request = new $.web.WebRequest($.net.http.GET, uriEncoded);


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 16, 2017 at 07:49 AM

    Is cloud connector running fine at both ends? check the destination set up too

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Muhsin,

      Thanks for replying.

      Yes destination is fine as its working for other Odata service without filter. Cloud connector is also working.

      Thanks,

      Sunit

  • avatar image
    Former Member
    Jan 30 at 11:31 AM

    Hi,

    Even we are facing the similar issue. Did you find a fix to the issue?

    Thanks,

    Mayur

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 18 at 11:43 AM

    Hi

    I'm also facing same issue, i'm not getting how to fix it. if anyone found solution ? Please let me know.

    Add comment
    10|10000 characters needed characters exceeded