cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Business One Service Layer , Customized API

staseeb
Active Participant
0 Kudos

Hello,

I have one customized API names "MYQUERY" , it takes 2 parameters, it is working fine when i am calling it (GET) from Postman. Following is the call

https://myserver.com:50000/b1s/v1/sml.svc/MYQUERYParameters(UserName='xxx',pStatus='N')/MYQUERY

1. When I consume it from another application (Java Script Appgyver), some time it comes up with perfect response. But some times it returns following error. "https://myserver.com:50000/b1s/v1/sml.svc/MYQUERYParameters(UserName='xxx',pStatus='N')/MYQUERY has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled".

Please note that, CORS is enabled, and * is placed in CORS Allowed Header Origin.

2. When i am trying to call this API directly from browser some time it return perfect response and some time it gives "proxy error the proxy server received an invalid response from an upstream server. the proxy server could not handle the request reason: error reading from remote server".

Please note that, SAP Business One standard APIs are working perfectly and dont have any CORS , or Proxy error.

Am i missing anything in customized API?

ankit.chauhan1 mariatrinidad.martinezgea can you help.

Thanks in advance.

Taseeb Saeed

Accepted Solutions (0)

Answers (1)

Answers (1)

merituulimelkko
Product and Topic Expert
Product and Topic Expert
0 Kudos

Are these outages occasional (once in a while) or does the outage last for a certain duration (several requests fail in a row)? If you're able to see these in the browser, can you check from your browser's developer console's network tab what the error code and response are?

Are you using SAP AppGyver from BTP or via community edition (platform.appgyver.com)?

What type of integration do you have set up to this API (REST API or BTP Destination)?

staseeb
Active Participant
0 Kudos
Hello merituulimelkko ,
  1. These outages last for a certain duration, several requests fails in a row.
  2. In browser Preflight Request comes up with Status: OK , fetch Request comes up with Status: 502
  3. I am using SAP AppGyver via community edition.
  4. It is a customized SAP Business One API, which is nothing but a calculation view exposed to service layer which take 2 input parameters. SAP Business One Standard APIs are working perfectly without any issue.
  5. Let me add here one more issue, Standard APIs are working fine for AppGyver on Web, Mobile Web, IoS but giving time out on android.

Please let me know if you need any further information.

Thanks,

Taseeb Saeed

staseeb
Active Participant
0 Kudos

Hello merituulimelkko

Any help?

Thanks,

merituulimelkko
Product and Topic Expert
Product and Topic Expert
0 Kudos

Oh so the problem only happens on Android for you? Or another problem only happens on Android for you?

It will probably not help but there are sometimes issues with certain APIs not working on either iOS or Android depending on if you have a trailing slash `/` in the base url of your API in its configuration – check if that makes a difference for you?

Other than that, I don't have any concrete ideas. I would try to check on multiple devices if the 502 only happens on one device at a time or on all devices. If the timeouts are short, you can work around this by creating logic in your app that handles dealing with these periodical timeouts with retrying logic and spinners etc.

I looked into the errors you're getting in general in SAP products and it seems sometimes these timeouts happen when the connection does not happen quickly enough and it times out. Please see possible solutions from e.g.
https://userapps.support.sap.com/sap/support/knowledge/en/2412533
https://blogs.sap.com/2016/05/25/how-to-avoid-502-proxy-error-when-adding-large-documents-via-servic...
https://answers.sap.com/questions/5770670/proxy-error.html