Unable to fetch data from on premise system using s4sdk - s4sdk

I followed the tutorial: https://open.sap.com/courses/s4h13/items/258qEhXx5kdG8b4SXMSJYp
I am able to fetch data from mocked service, but I get an empty array when I add an on premise sap system in my destination.
I am trying to read ProductMaster service (which is available in my sap system).
any guidance or link of correct blog will be much appreciated.
Application logs:-
2019-01-31T09:49:30.98+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:30.980Z","written_ts":3583833066597470,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.container.UserInfoTomcat","thread":"http-bio-0.0.0.0-8080-exec-1","level":"INFO","categories":[],"msg":"Parsing SAP_JWT_TRUST_ACL (value: [{\"clientid\" : \"\", \"identityzone\" : \"\"}])" }
2019-01-31T09:49:30.98+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:30.980Z","written_ts":3583833067255806,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.container.UserInfoTomcat","thread":"http-bio-0.0.0.0-8080-exec-1","level":"INFO","categories":[],"msg":"Access token of service plan \"application\" received" }
2019-01-31T09:49:30.98+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:30.980Z","written_ts":3583833067335285,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.commons.SAPVcapServicesParser","thread":"http-bio-0.0.0.0-8080-exec-1","level":"INFO","categories":[],"msg":"VCAP_SERVICES: Only one applicable binding exists, service plan hint \"application\" is not used" }
2019-01-31T09:49:30.98+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:30.980Z","written_ts":3583833067403879,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.commons.SAPPropertyPlaceholderConfigurer","thread":"http-bio-0.0.0.0-8080-exec-1","level":"INFO","categories":[],"msg":"Got from VCAP_SERVICES: clientid=sb-address-manager-p1942271708trial!t9649" }
2019-01-31T09:49:37.03+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:37.030Z","written_ts":3583839116771998,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.container.UserInfoTomcat","thread":"http-bio-0.0.0.0-8080-exec-3","level":"INFO","categories":[],"msg":"Parsing SAP_JWT_TRUST_ACL (value: [{\"clientid\" : \"\", \"identityzone\" : \"\"}])" }
2019-01-31T09:49:37.03+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:37.030Z","written_ts":3583839117339973,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.container.UserInfoTomcat","thread":"http-bio-0.0.0.0-8080-exec-3","level":"INFO","categories":[],"msg":"Access token of service plan \"application\" received" }
2019-01-31T09:49:37.03+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:37.030Z","written_ts":3583839117412082,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.commons.SAPVcapServicesParser","thread":"http-bio-0.0.0.0-8080-exec-3","level":"INFO","categories":[],"msg":"VCAP_SERVICES: Only one applicable binding exists, service plan hint \"application\" is not used" }
2019-01-31T09:49:41.02+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.026Z","written_ts":3583843112511705,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.commons.SAPVcapServicesParser","thread":"http-bio-0.0.0.0-8080-exec-10","level":"INFO","categories":[],"msg":"VCAP_SERVICES: Only one applicable binding exists, service plan hint \"application\" is not used" }
2019-01-31T09:49:41.02+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.026Z","written_ts":3583843112682598,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs2.security.commons.SAPPropertyPlaceholderConfigurer","thread":"http-bio-0.0.0.0-8080-exec-10","level":"INFO","categories":[],"msg":"Got from VCAP_SERVICES: verificationkey=-----BEGIN PUBLIC KEY-----MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwThn6OO9kj0bchkOGkqYBnV1dQ3zU/xtj7Kj7nDd8nyRMcEWCtVzrzjzhiisRhlrzlRIEY82wRAZNGKMnw7cvCwNixcfcDJnjzgr2pJ+5/yDZUc0IXXyIWPZD+XdL+0EogC3d4+fqyvg/BF/F0t2hKHWr/UTXE6zrGhBKaL0d8rKfYd6olGWigFd+3+24CKI14zWVxUBtC+P9Fhngc9DRzkXqhxOK/EKn0HzSgotf5duq6Tmk9DCNM4sLW4+ERc6xzrgbeEexakabvax/Az9WZ4qhwgw+fwIhKIC7WLwCEJaRsW4m7NKkv+eJR2LKYesuQ9SVAJ3EXV86RwdnH4uAv7lQHsKURPVAQBlranSqyQu0EXs2N9OlWTxe+FyNkIvyZvoLrZl/CdlYc8AKxRm5rn2/88nkrYQ0XZSrnICM5FRWgVF2hn5KfZGwtBN85/D4Yck6B3ocMfyX7e4URUm9lRPQFUJGTXaZnEIge0R159HUwhTN1HvyXrs6uT1ZZmW+c3p47dw1+LmUf/hIf8zd+uvHQjIeHEJqxjqfyA8yqAFKRHKVFrwnwdMHIsRap2EKBhHMfeVf0P2th5C9MggYoGCvdIaIUgMBX3TtCdvGrcWML7hnyS2zkrlA8SoKJnRcRF2KxWKs355FhpHpzqyZflO5l98+O8wOsFjGpL9d0ECAwEAAQ==-----END PUBLIC KEY-----" }
2019-01-31T09:49:41.02+0530 [APP/PROC/WEB/0] OUT audit/security-events: {"uuid":"f9e8cee3-accc-4ea0-b1a8-8eb0332610c3","user":"armoghan.abbas#gmail.com","time":"2019-01-31T04:19:41.029Z","ip":"52.28.241.88","data":"Successful log on for 'armoghan.abbas#gmail.com' from 52.28.241.88.","tenant":"9f0f4bb3-bb5f-4745-b992-7d41c3100573"}
2019-01-31T09:49:41.03+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.030Z","written_ts":3583843117462454,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.xs.security.container.XSSecurityAuthenticator","thread":"http-bio-0.0.0.0-8080-exec-10","level":"WARN","categories":[],"msg":"AuditLog service binding is not available. The message will be written in console output.","stacktrace":["com.sap.xs.audit.api.exception.AuditLogNotAvailableException: Cannot send audit log message to the backend. Missing audit log service credentials parameters or binding to an auditlog service instance.","\tat com.sap.xs.audit.client.impl.ConsoleCommunicator.send(ConsoleCommunicator.java:10)","\tat com.sap.xs.audit.client.impl.AuditLogMessageImpl.log(AuditLogMessageImpl.java:85)","\tat com.sap.xs.security.container.XSSecurityAuthenticator.logSecurityEventAuditMessage(XSSecurityAuthenticator.java:112)","\tat com.sap.xs.security.container.XSSecurityAuthenticator.logSuccessfulLogonAuditMessage(XSSecurityAuthenticator.java:97)","\tat com.sap.xs.security.container.XSSecurityAuthenticator.authenticate(XSSecurityAuthenticator.java:45)","\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:566)","\tat com.sap.xs.security.container.XSSecurityAuthenticator.invoke(XSSecurityAuthenticator.java:131)","\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)","\tat com.sap.xs.java.valves.ErrorReportValve.invoke(ErrorReportValve.java:66)","\tat ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:191)","\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)","\tat com.sap.xs.security.UserInfoValve.invoke(UserInfoValve.java:19)","\tat com.sap.xs.statistics.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:43)","\tat com.sap.xs.logging.catalina.RuntimeInfoValve.invoke(RuntimeInfoValve.java:40)","\tat org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:695)","\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)","\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)","\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)","\tat org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)","\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)","\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)","\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)","\tat java.lang.Thread.run(Thread.java:836)"] }
2019-01-31T09:49:41.03+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.034Z","written_ts":3583843120774921,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.s4hana.examples.addressmgr.BusinessPartnerServlet","thread":"http-bio-0.0.0.0-8080-exec-10","level":"INFO","categories":[],"msg":"Retrieving all business partners" }
2019-01-31T09:49:41.38+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.383Z","written_ts":3583843469583997,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext","thread":"http-bio-0.0.0.0-8080-exec-10","level":"INFO","categories":[],"msg":"Falling back to locale \"en_US\". To specify the locale, set the property on destination \"ErpQueryEndpoint\" or provide the locale as explicit argument. (END OF LOG ENTRY)" }
2019-01-31T09:49:41.38+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.384Z","written_ts":3583843471009201,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"INFO","categories":[],"msg":"Falling back to locale \"en_US\". To specify the locale, set the property on destination \"ErpQueryEndpoint\" or provide the locale as explicit argument. (END OF LOG ENTRY)" }
2019-01-31T09:49:41.38+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.386Z","written_ts":3583843472964643,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.ODataQuery","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Successfully connected to destination service." }
2019-01-31T09:49:41.64+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.639Z","written_ts":3583843726319402,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.cache.metadata.GuavaMetadataCache","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Error occurred during populating metadata : com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler$ErpODataException: " }
2019-01-31T09:49:41.64+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.640Z","written_ts":3583843726825327,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.ODataQuery","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Successfully connected to destination service." }
2019-01-31T09:49:41.75+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.751Z","written_ts":3583843838110377,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.cache.metadata.GuavaMetadataCache","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Error occurred during populating metadata : com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler$ErpODataException: " }
2019-01-31T09:49:41.75+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.752Z","written_ts":3583843838680972,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.ODataQuery","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Successfully connected to destination service." }
2019-01-31T09:49:41.86+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.864Z","written_ts":3583843950626395,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.cache.metadata.GuavaMetadataCache","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Error occurred during populating metadata : com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler$ErpODataException: " }
2019-01-31T09:49:41.86+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.864Z","written_ts":3583843950942012,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.ODataQuery","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Successfully connected to destination service." }
2019-01-31T09:49:41.97+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.977Z","written_ts":3583844063669784,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.sdk.odatav2.connectivity.cache.metadata.GuavaMetadataCache","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"ERROR","categories":[],"msg":"Error occurred during populating metadata : com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler$ErpODataException: " }
2019-01-31T09:49:41.98+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.980Z","written_ts":3583844066956104,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand","thread":"hystrix-com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand#t=#u=-6","level":"WARN","categories":[],"msg":"Fallback called because of exception:","stacktrace":["java.util.concurrent.ExecutionException: com.sap.cloud.sdk.odatav2.connectivity.ODataException: Failed to execute OData Metadata request.","\tat com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:526)","\tat com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:487)","\tat com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:83)","\tat com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:196)","\tat com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2311)","\tat com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2277)","\tat com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154)","\tat com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044)","\tat com.google.common.cache.LocalCache.get(LocalCache.java:3951)","\tat com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4870)","\tat com.sap.cloud.sdk.frameworks.hystrix.CachingCommand.run(CachingCommand.java:178)","\tat com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)","\tat com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)","\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)","\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","\tat rx.Observable.unsafeSubscribe(Observable.java:10256)","\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)","\tat rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)","\tat rx.Observable.unsafeSubscribe(Observable.java:10256)","\tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)","\tat rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)","\tat rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)","\tat rx.Observable.unsafeSubscribe(Observable.java:10256)","\tat rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)","\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)","\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)","\tat com.sap.xs.threadlocal.hystrix.ThreadLocalCallable.call(ThreadLocalCallable.java:29)","\tat com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)","\tat rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)","\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)","\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)","\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)","\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)","\tat java.lang.Thread.run(Thread.java:836)","Caused by: com.sap.cloud.sdk.odatav2.connectivity.ODataException: Failed to execute OData Metadata request.","\tat com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.loadEntriesFromDestination(ODataQuery.java:215)","\tat com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.internalExecute(ODataQuery.java:167)","\tat com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.execute(ODataQuery.java:105)","\tat com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.execute(ODataQuery.java:150)","\tat com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.execute(ODataQuery.java:136)","\tat com.sap.cloud.sdk.s4hana.datamodel.odata.helper.FluentHelperRead.execute(FluentHelperRead.java:197)","\tat com.sap.cloud.sdk.s4hana.datamodel.odata.helper.FluentHelperRead.execute(FluentHelperRead.java:23)","\tat com.sap.cloud.sdk.s4hana.datamodel.odata.helper.FluentHelperBasic.execute(FluentHelperBasic.java:85)","\tat com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand.runCacheable(GetAllProductsCommand.java:53)","\tat com.sap.cloud.s4hana.examples.addressmgr.commands.GetAllProductsCommand.runCacheable(GetAllProductsCommand.java:19)","\tat com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4875)","\tat com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)","\tat com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2276)","\t... 35 more","Caused by: com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler$ErpODataException: ","\tat com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler.createException(ODataVdmErrorResultHandler.java:105)","\tat com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler.createError(ODataVdmErrorResultHandler.java:86)","\tat com.sap.cloud.sdk.s4hana.datamodel.odata.helper.ODataVdmErrorResultHandler.createError(ODataVdmErrorResultHandler.java:31)","\tat com.sap.cloud.sdk.odatav2.connectivity.internal.ODataConnectivityUtil.checkHttpStatus(ODataConnectivityUtil.java:185)","\tat com.sap.cloud.sdk.odatav2.connectivity.cache.metadata.GuavaMetadataCache.getEdm(GuavaMetadataCache.java:131)","\tat com.sap.cloud.sdk.odatav2.connectivity.cache.metadata.GuavaMetadataCache.getEdm(GuavaMetadataCache.java:110)","\tat com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.loadMetadata(ODataQuery.java:250)","\tat com.sap.cloud.sdk.odatav2.connectivity.ODataQuery.loadEntriesFromDestination(ODataQuery.java:213)","\t... 47 more"] }
2019-01-31T09:49:41.98+0530 [APP/PROC/WEB/0] OUT { "written_at":"2019-01-31T04:19:41.981Z","written_ts":3583844067895750,"component_id":"ae30fb63-3ddc-42e4-95c9-c190e7c5950e","component_name":"address-manager","DCComponent":"","HOST":"0ca2bbc0-3f71-4dfd-5e4e-8577","organization_name":"-","component_type":"application","space_name":"dev","SERVER":"main","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"71c96992-bd88-41e6-ac83-bdcc94e38fc6","Application":"address-manager","container_id":"10.0.137.101","type":"log","logger":"com.sap.cloud.s4hana.examples.addressmgr.BusinessPartnerServlet","thread":"http-bio-0.0.0.0-8080-exec-10","level":"INFO","categories":[],"msg":"Armoghan says - []" }
address-manager-grumpy-otter.cfapps.eu10.hana.ondemand.com - [2019-01-31T04:19:41.027+0000] "GET /api/business-partners HTTP/1.1" 200 0 2 "https://approuter-p1942271708trial.cfapps.eu10.hana.ondemand.com/address-manager/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" "-" "10.0.137.101:61002" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"4b3e148c-ac4a-444f-5676-00f83c7fda10" response_time:0.963585441 app_id:"ae30fb63-3ddc-42e4-95c9-c190e7c5950e" app_index:"0" x_correlationid:"c3b465c1-cdad-4fe4-7033-9c9b3d8b7971" x_b3_traceid:"ee848c54fc661573" x_b3_spanid:"ee848c54fc661573" x_b3_parentspanid:"-"

When connecting against an On-Premise system, you need to have a connectivity service instance bound to your application, in addition to xs-uaa and destination service instances. Also, make sure that you have configured the Cloud Connector correctly.
The following deep dive describes the required prerequisites to connect to S/4HANA OP from SAP Cloud Platform Cloud Foundry (see the abstract Running Business Partner Calls Against S/4HANA On-Premise)

I had not put any value in 'Location' field of my destination, I am able to fetch values from a standard OData service now.

Related

Multipart request rejected because no bounday were found while boundary is already sent

I went through the other similar questions but couldn't find any solution. We have a backend service running by Spring Boot and has been working for a while now. But there is a new user of this service recently and they are using MuleSoft to send their request. But all attempts to send a file to our service fails with this error:
Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found"
The only difference we could find between a request from MuleSoft and say a curl command is that MuleSoft always sends the request with boundary value wrapped with double quotes
Mule request:
<Header name="Content-Type">multipart/form-data; charset=UTF-8; boundary="--------------------------669816398596264398718285"</Header>
Versus Postman/curl request:
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fd656810a00)
> POST /api/upload HTTP/2
> Host: myhost
> user-agent: curl/7.79.1
> accept: */*
> content-length: 97255
> content-type: multipart/form-data; boundary=------------------------111fd08cb4fafe1c
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
* We are completely uploaded and fine
< HTTP/2 200
< date: Mon, 19 Dec 2022 04:56:25 GMT
< content-length: 0
Our controller in Spring is very simple:
#RestController
class MyController {
#PostMapping("/upload", consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
#ResponseStatus(HttpStatus.OK)
fun uploadDocument(#RequestPart("file") file: MultipartFile) {
logger.info { "ContentType: ${file.contentType}" }
logger.info { "Name: ${file.name}" }
logger.info { "Byte: ${String(file.bytes)}" }
}
}
The following curl command works fine:
curl -v -X POST -F file=#/Users/myhomefolder/Documents/some-file.jpg https://host-name/api/upload
But this script from MuleSoft doesn't (Sorry I'm not familiar with Mule, I got this code from their team):
import dw::module::Multipart
output multipart/form-data boundary = "---WebKitFormBoundary7MA4YWxkTrZu0gW"
---
{
parts : {
file : {
headers : {
"Content-Disposition" : {
"name": "file",
"filename": payload.name
},
"Content-Type" : "multipart/form-data"
},
content : payload.byteArray
}
}
}
Is there any configuration in Spring that accepts double quotes for boundary? Is there anything missing in our backend configuration that should be added to support different HTTP client?

ELK serilog sink FailureCallback

I was able to successfully integrate the elastic search sink in my .net app, now I am trying to setup the FailureCallback option but every time there is an error the exception in LogEvent is null, I can see the actual error in the console but I want to be able to capture this exception in my failure callback function, here is my current configuration:
myLogger = new LoggerConfiguration()
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(elasticSearchUrl))
{
AutoRegisterTemplate = true,
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6,
IndexDecider = (#event, dateTimeOffset) =>
{
//some logic here
return $"custom-index";
},
EmitEventFailure = EmitEventFailureHandling.WriteToSelfLog | EmitEventFailureHandling.RaiseCallback,
FailureCallback = HandleElasticError
})
.Enrich.WithProperty("Environment", Config.Environment)
.Destructure.ByTransforming<ExpandoObject>(JsonConvert.SerializeObject)
.CreateLogger();
Here is my HandleElasticError function:
private void HandleElasticError(LogEvent e)
{
FileLogger.Error(e.Exception, e.MessageTemplate.Text, e.Properties);
}
When I attach the debugger and inspect the LogEvent, exception is null, however in the output window in Visual Studio I can see the actual error:
2020-11-30T20:55:07.7820674Z Caught exception while preforming bulk operation to Elasticsearch: Elasticsearch.Net.ElasticsearchClientException: The underlying connection was closed: An unexpected error occurred on a send.. Call: Status code unknown from: POST /_bulk ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: The handshake failed due to an unexpected packet format.
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
I am not concerned about the error, I know what the issue is, I just want to be able to capture this exception in my failure callback function.
Any ideas?
LogEvent.Exception is the Exception shipped with your call to (for example) logger.Error(myException) - not the exception thrown by failure to write to Elastic Search.
The exception you're trying to catch doesn't look to be exposed by the sink as it just passes the LogEvent to FailureCallback and not exception that caused the failure.
Here's what it could look like were the exception exposed.
you can use:
StreamWriter writer = File.CreateText(...);
Serilog.Debugging.SelfLog.Enable(writer);

Kotlin & Spring MVC - HTTP Status 400 - Null

I have a Kotlin #RestController, and I would expect it to return 400 Bad Request in a situation where a null is passed for a #RequestParam argument.
Example:
#RestController
class Api() {
#PostMapping("endpoint")
fun endpoint(#DateTimeFormat(iso = DATE) #RequestParam date: LocalDate) {
//do something
}
}
If I were to make a request to POST /endpoint?date I get a 500 Internal Server Error with the following (shortened) body:
{
"timestamp": "2020-09-14T20:39:38.102+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Parameter specified as non-null is null: method Api.endpoint, parameter date",
"trace": "java.lang.IllegalArgumentException: Parameter specified as non-null is null: method Api.endpoint, parameter date\r\n\tat Api.endpoint(Api.kt)\r\n\t
...
...
atjava.base/java.lang.Thread.run(Thread.java:834)\r\n",
"path": "/campaigns/contributions/unfunded/retries"
}
Is there any way to fix this using either some additional library, a configuration, or some custom code that does not have other side effects that keeps everything the same except that the status code will be 400 Bad Request
The following works for Kotlin 1.4.*. This is not necessarily the best answer because there is no guarantee that Kotlin will not change the excption type of message in future releases. For eaxample, when I originally asked the question I was using 1.3.*, and the exception was IllegalArgumentException. In 1.4.* it has been changed to NullPointerException.
#ControllerAdvice
class KotlinNonNullParamHandling {
#ExceptionHandler
protected fun handleKotlinNonNullViolation(
exception: NullPointerException,
response: HttpServletResponse
) {
val nullParameter = exception.message?.startsWith("Parameter specified as non-null is null: ") == true
val restController = exception
.stackTrace
.getOrNull(0)
?.let { Class.forName(it.className) }
?.getAnnotation(RestController::class.java) != null
val status =
if (nullParameter && restController) HttpStatus.BAD_REQUEST
else HttpStatus.INTERNAL_SERVER_ERROR
response.sendError(status.value(), exception.message)
}
}
Before assuming that it is 400, we are checking that the exception
is a NullPointerException
has a message starting with "Parameter specified as non-null is null: "
it was thrown from a class the is RestController (otherwise it might be some other problem, such as a null being sent to a method by reflection having nothing to do with the web layer.)
Spring will throw the IllegalArgumentException by default when a validation fails here. Every exception inside your Spring-Boot application will be treated by default as InternalServerError.
You can modify your response code by adding a function like this:
#RestController
class Api() {
#ExceptionHandler(IllegalArgumentException.class)
#ResponseStatus(HttpStatus.BAD_REQUEST)
public void onIllegalArgumentException(IllegalArgumentException e) {
}
#PostMapping("endpoint")
fun endpoint(#DateTimeFormat(iso = DATE) #RequestParam date: LocalDate) {
//do something
}
}
Afterwards you'll get the 400 status code on invalid request param.
I've tested your code, and there's nothing obviously wrong with it - works as expected.
curl -v -d "date=2020-10-01" http://localhost:8080/endpoint
* Trying ::1:8080...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> POST /endpoint HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 15
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 15 out of 15 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200
< Content-Length: 0
< Date: Tue, 13 Oct 2020 07:04:21 GMT
<
* Connection #0 to host localhost left intact
So I would:
Verify that the client is properly formatting the request - e.g. try explicitly setting the Content-Type header to application/x-www-form-urlencoded, check if there's no typo in the param name etc.
That you have Jackson properly configured to work with Kotlin (com.fasterxml.jackson.module:jackson-module-kotlin - dependency)

Azure Form Recognizer training not finding data

I'm trying to train a Form Recognizer using the browser API console (https://eastus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api/operations/TrainCustomModel/console). I've uploaded traning images to a container and created an SAS. The browser API console generate following HTTP request:
POST https://eastus.api.cognitive.microsoft.com/formrecognizer/v1.0-preview/custom/train?source=https://pythonimages.blob.core.windows.net/?sv=2019-02-02&ss=bfqt&srt=sco&sp=rl&se=2020-01-22T00:23:33Z&st=2020-01-21T16:23:33Z&spr=https&sig=••••••••••••••••••••••••••••••••&prefix=images HTTP/1.1
Host: eastus.api.cognitive.microsoft.com
Content-Type: application/json
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
{
"source": "string",
"sourceFilter": {
"prefix": "string",
"includeSubFolders": true
}
}
However, the answer I get back is
Transfer-Encoding: chunked
x-envoy-upstream-service-time: 4
apim-request-id: 5ad37aa2-e251-4b61-98ae-023930b47d27
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
Date: Tue, 21 Jan 2020 16:25:03 GMT
Content-Type: application/json; charset=utf-8
{
"error": {
"code": "1004",
"message": "Dataset path must be relative to local input mount path '/input' if local data is referenced."
}
}
I don't understand why it seems to be looking for data locally. I've experimented with the SAS, e.g. including the container name (images) in the blob http address rather than as a query parameter, but no success so far.
I've also tried the Python/REST path (described here: https://learn.microsoft.com/en-gb/azure/cognitive-services/form-recognizer/quickstarts/python-train-extract-v1), which results in a different error:
Response status code: 408
Response body: {'error': {'code': '1011', 'innerError': {'requestId': 'e7f9ef9f-97bc-4b6a-86f3-0b29c9591c87'}, 'message': 'The operation exceeded allowed time limit and was canceled. The common reasons are that the data source is too large or contains unsupported content. Please check that your request conforms to service limits and retry with redacted data source.'}}
For completeness, the code I use is as follows (key/signature *ed out:)
########### Python Form Recognizer Train #############
from requests import post as http_post
# Endpoint URL
base_url = r"https://markusformsrecognizer.cognitiveservices.azure.com/" + "/formrecognizer/v1.0-preview/custom"
source = r"https://pythonimages.blob.core.windows.net/images?sv=2019-02-02&ss=bfqt&srt=sco&sp=rl&se=2020-01-22T15:37:26Z&st=2020-01-22T07:37:26Z&spr=https&sig=*********************************"
headers = {
# Request headers
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': '*********************************'
}
url = base_url + "/train"
body = {"source": source}
try:
resp = http_post(url = url, json = body, headers = headers)
print("Response status code: %d" % resp.status_code)
print("Response body: %s" % resp.json())
except Exception as e:
print(str(e))
For error code 1004 Please follow the below to get the Source path containing the training documents and pass as value to the source key.
{
"source": "string",
"sourceFilter": {
"prefix": "string",
"includeSubFolders": true
}
}
Replace with the Azure Blob storage container's shared access signature (SAS) URL. To retrieve the SAS URL, open the Microsoft Azure Storage Explorer, right-click your container, and select Get shared access signature.
Make sure the Read and List permissions are checked, and click Create.
Then copy the value in the URL section. It should have the form:
https://.blob.core.windows.net/container name?SAS value.
Please use the new Form Recognizer v2.0 release it is an async API and enables training on large data sets and analyzing large documents. https://aka.ms/form-recognizer/api
quick start - https://learn.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/python-train-extract
To get started with Form Recognizer please login to the Azure Portal using this link to create a Form Recognizer resource (for v2.0 (preview) please use West US 2 or West Europe regions).
try removing the string value from prefix property.
{
"source": "string",
"sourceFilter": {
"prefix": "",
"includeSubFolders": true
}
}
The Python Quick Start code for version 2.0 seems to be working, at least I don’t get any errors anymore. I’m now feeling slightly silly that I didn’t try this earlier. The API (web-browser) console, linked from the Quick Start page of the Form Recognizer seems automatically assume I want to use version 1.0 and there’s no way to change that (or perhaps I’ve just overseen something). Hence I assumed I’d been allocated a v1.0 trial and therefore that’s what I used when I tried the Python Quick Start the first time around.
Instead of using just the SAS URI in the "source" of Request parameter on the API POST call, use the complete string of the container followed by the SAS URI token.
For ex:
https://.blob.core.windows.net//

Failure connecting to S/4 Hana via Cloud SDK

I'm following the OData tutorial at https://blogs.sap.com/2017/05/21/step-4-with-sap-s4hana-cloud-sdk-calling-an-odata-service/comment-page-1/ and I'm getting an error when I try to retrieve business partners using DefaultBusinessPartnerService.
The relevant piece of code is:
DefaultBusinessPartnerService businessPartnerService = new DefaultBusinessPartnerService();
System.err.println("criated default business partner");
List<BusinessPartner> partners = businessPartnerService
.getAllBusinessPartner()
.select(BusinessPartner.BUSINESS_PARTNER,
BusinessPartner.LAST_NAME,
BusinessPartner.FIRST_NAME)
//.filter(BusinessPartner.BUSINESS_PARTNER_CATEGORY.eq(CATEGORY_VENDOR))
.orderBy(BusinessPartner.LAST_NAME, Order.ASC)
.execute(new ErpEndpoint(new ErpConfigContext()));
response.setContentType("application/json");
response.getWriter().write(new Gson().toJson(partners));
My ErpQueryEndpoint configuration is as follows:
#Mon May 14 15:27:09 BRT 2018
URL=https\://host\:port
Name=ErpQueryEndpoint
TrustAll=TRUE
Type=HTTP
Password=Password
Authentication=BasicAuthentication
User=Username
Where host, port, Username and Password have been replaced by the correct values.
When I query http://localhost:8080/s4integration-application/businesspartners I get the following error:
The endpoint responded with HTTP error code 403.
No service found for namespace , name API_BUSINESS_PARTNER, version 0001
Full error message:
{
"error": {
"code": "/IWFND/MED/170",
"message": {
"lang": "en",
"value": "No service found for namespace , name API_BUSINESS_PARTNER, version 0001"
},
"innererror": {
"application": {
"component_id": "",
"service_namespace": "/SAP/",
"service_id": "API_BUSINESS_PARTNER",
"service_version": "0001"
},
"transactionid": "C83CB3D2A1420000E005AF97B0836AD5",
"timestamp": "20180514182746.3576100",
"Error_Resolution": {
"SAP_Transaction": "Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system (System Alias ) and search for entries with the timestamp above for more details",
"SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"
},
"errordetails": []
}
}
}
It seems that the endpoint is not configured on the SAP system (it's an S/4 Hana system). I'm not sure if I have to add something else to the URL besides the host and port or if there is some other configuration that has to be done on the SAP system.
Instructions for activating OData APIs from the SAP S/4HANA backend can be found here: help.sap.com/viewer/cdc25c83b63e482586b31b8acd49cf2f/1610%20003/… Just ignore the notion of the Fiori app.

Resources