SAP integration with Azure Logic Apps - Cache / Metadata problem? - azure

I'm trying to automatize process using Logic Apps -> On-premises data gateway -> SAP system.
I think I have a problem with metadata or cache.
Scenario:
I stopped developing solution on Wednesday about 23 (it didn't work), I didn't change anything inside and started to work on Thursday (today) about 12. I had to remind myself what kind of bug it was so i ran this logic app and suddenly it worked fine. I've been using element [RFC] Call function in SAP in Logic Apps with input RFC parameters:
<ZFM_MGR_RFC xmlns="http://Microsoft.LobServices.Sap/2007/03/Rfc/">
<INVOICE_ID>#{outputs('Invoice')['InvoiceId']}</INVOICE_ID>
</ZFM_MGR_RFC>
ABAP FM:
IMPORTING
VALUE(INVOICE_DATE) TYPE STRING OPTIONAL
DATA: ls_test TYPE zasd_test.
ls_test-mandt = sy-mandt.
ls_test-dates = sy-datum.
ls_test-time = sy-timlo.
INSERT zasd_test FROM ls_test.
So... I decided to enhance my FM in ABAP with another importing parameters. I added for example CUSTOMER_NAME parameter (string) and input parameter in Logic Apps. Suddenly I have an error - there's my [RFC] Call function in SAP response:
{
"statusCode": 400,
"headers": {
"x-ms-request-id": "7c4b6579-956d-4816-b988-73ad72d2962e",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Cache-Control": "no-store",
"Set-Cookie": "ARRAffinity=db497ba0020393419ac466ef860f11922d2080b57a6df974e13c227f651e3274;Path=/;HttpOnly;Secure;Domain=sap-gwc.azconn-gwc.p.azurewebsites.net,ARRAffinitySameSite=db497ba0020393419ac466ef860f11922d2080b57a6df974e13c227f651e3274;Path=/;HttpOnly;SameSite=None;Secure;Domain=sap-gwc.azconn-gwc.p.azurewebsites.net",
"x-ms-connection-gateway-object-id": "7ebb3fec-1964-41ff-b45b-b97e71c65616",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "true",
"Date": "Thu, 15 Jul 2021 21:37:41 GMT",
"Content-Length": "202",
"Content-Type": "application/json"
},
"body": {
"error": {
"code": "GeneralBadRequest",
"message": "Failed to process request. Error details: 'Parameter: 'CUSTOMER_NAME' not found in the function metadata.'.",
"target": ""
}
}
}
It looks like Logic Apps/On-premise gateway has metadata of function module saved somewhere and refresh it not very often. How can I change it?
Thanks in advance.

I found a solution. Inside On-premises data gateway in settings overlap there is "Restart right now" button. Everytime you change something inside configuration/source code of program you have to click this button.
Warning: restarting computer doesn't give the same result. You have to restart gateway manually.
PS If you don't use On-Premise SAP Gateway you can temporarily test your solution with copying one FM to another and running the 2nd one.

Related

Storing/managing PWA push notification subscription data for same user with multiple devices?

Maybe I'm misunderstanding something but every article/tutorial I've read about push notifications seems to be leaving this detail out.
For reference, web-push's sendNotification method accepts pushSubscription, payload, and options.
To send a notification to a user at any point in time, the user's pushSubscription data would need to be stored in a database and retrieved to be used as needed, right? So if the user has enabled push notifications for multiple devices, the pushSubscription data would need to be stored for each device.
I guess my question is... How do you know when e.g. a device is no longer in use so that you can delete the stale pushSubscription data? Or suppose, for whatever reason, the PushManager generates a new pushSubscription for the same user + device... How would you know to replace the old pushSubscription with the new one?
Is the solution to build a device manager for the user to manage each device and its associated push subscription(s)?
I think you have this right -- a nice implementation is one where you show the browser(s) with push notifications enabled. Another way is you just prompt to enable push notifications if they aren't enabled in the current browser in use.
Stale: HTTP 410 Gone
I've found that when a push notification goes away, the push endpoint will return a HTTP 410 Gone status code. So if I get that in response to a push attempt, I remove that push entry.
Microsoft Edge rate limits with HTTP 406
On a side note, I found in practice that the Microsoft Edge push servers will often return a HTTP 406 Not Acceptable status code if you push too many notifications. So in a perfect world, in an app where many notifications were sent, we'd alert the user about that issue. Here is an example of that response:
{
"name": "WebPushError",
"message": "Received unexpected response code",
"statusCode": 406,
"headers": {
"content-length": "0",
"retry-after": "900",
"x-wns-notificationstatus": "appthrottled",
"x-wns-status": "appthrottled",
"x-wns-msg-id": "_redacted_",
"x-wns-debug-trace": "_redacted_",
"ms-cv": "_redacted_.0",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"date": "Fri, 21 Oct 2022 15:55:28 GMT",
"connection": "close"
},
"body": "",
"endpoint": "https://wns2-bl2p.notify.windows.com/w/?token=_redacted_"
}
I was surprised to find there isn't really a lot of solid technical articles about implementing push notifications in the big picture. Once you get into the details, it's not too bad but it is definitely an area which could use more documentation and discussion.

General Exception Microsoft Graph API OfficeConversion_ConverterInternal

I've been calling this endpoint for the last month or so by converting my word document into a pdf and its been working fine:
https://graph.microsoft.com/v1.0/drives/{drive_id}/root/children('example.docx')/content?format=pdf
I tried this today and it seem that i don't get the pdf as a response but rather:
{
"error": {
"code": "generalException",
"message": "Error from Office Service. Url=https://wordcs.officeapps.live.com/document/export/pdf HttpCode=NotFound cert=subject:;thumbprint: ResponseHeaders=Connection: close\r\nDate: Wed, 27 Jan 2021 14:14:23 GMT\r\nServer: Microsoft-IIS/10.0\r\nX-Powered-By: ASP.NET\r\n",
"innererror": {
"code": "OfficeConversion_ConverterInternal"
}
}
}
I followed these docs from Microsoft but with no help :/
https://learn.microsoft.com/en-us/graph/api/driveitem-get-content-format?view=graph-rest-1.0&tabs=http
When i don't use the format parameter to fetch the pdf conversion i can successfully get a response (200) from the original file atleast:
https://graph.microsoft.com/v1.0/drives/{drive_id}/root/children('example.docx')/content
Have the Microsoft Graph API been updated recently?
Also i do have all Azure access and all of that since this has been working fine for the past month so I'm almost certain the API has changed or perhaps my domain got blocked or something...
please check now. The issue has been resolved.

How to enable JSON response for SharePoint 2013 REST APIs onpremise?

I am using SharePoint 2013 onprem and online version for integration purpose. While accessing REST APIs for online SharePoint, I was able to use application/json and application/xml as ACCEPT header with no issues.
However, while accessing SharePoint 2013 onpremise REST APIs I could use application/xml as ACCEPT header and using application/json throwing below error:
GET - http://xxxxxxx:8300/_api/web/
Header -
Accept:application/json
Response:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ClientServiceException",
"message": {
"lang": "en-US",
"value": "The HTTP header ACCEPT is missing or its value is invalid."
}
}
}
Could you please suggest How can I get JSON response for LIST, LISTITEM objects?
Try this:
"accept": "application/json; odata=verbose"
I've encountered this type of issue before in on-premise SharePoint 2013. Mike's answer also has merit. You will need to change your Accept header value to "application/json;odata=verbose", though I don't think that is the issue. I think you need to patch the on-premise instance of SharePoint to support OData 3 and JSON Light. Read the instructions carefully from the following blog post. As we deploy solutions in the field, we still find farms that encounter this when we make requests for json from the REST API. However, you are far more likely to find it in a freshly spun up development instance. It's relatively quick and simple to address. Good Luck!
Edit:
It appears the Technet article was recently removed. Here is the download link for WCF Data Services 5.6. Still follow the guidance in original post and I think you'll be up and running pretty quickly. In addition, you should be able to drop off the odata=verbose portion of the Accept header after this update.
PowerShell To Complete the Upgrade (Run after the WCF Data Services Install)
Run this on the SharePoint Server that your upgraded WCF Data Services on.
$configOwnerName = "JSONLightDependentAssembly"
$spWebConfigModClass ="Microsoft.SharePoint.Administration.SPWebConfigModification"
$dependentAssemblyPath ="configuration/runtime/*[local-name()='assemblyBinding' and namespace-uri()='urn:schemas-microsoft-com:asm.v1']"
$dependentAssemblyNameStart ="*[local-name()='dependentAssembly'][*/#name='"
$dependentAssemblyNameEnd = "'][*/#publicKeyToken='31bf3856ad364e35'][*/#culture='neutral']"
$dependentAssemblyValueStart = "<dependentAssembly><assemblyIdentity name='"
$dependentAssemblyValueEnd ="' publicKeyToken='31bf3856ad364e35' culture='neutral' /><bindingRedirect oldVersion='5.0.0.0' newVersion='5.6.0.0' /></dependentAssembly>"
$edmAssemblyName ="Microsoft.Data.Edm"
$odataAssemblyName ="Microsoft.Data.Odata"
$dataServicesAssemblyName ="Microsoft.Data.Services"
$dataServicesClientAssemblyName ="Microsoft.Data.Services.Client"
$spatialAssemblyName ="System.Spatial"
$assemblyNamesArray = $edmAssemblyName,$odataAssemblyName,$dataServicesAssemblyName,$dataServicesClientAssemblyName, $spatialAssemblyName
Add-PSSnapin Microsoft.SharePoint.Powershell
$webService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
################ Adds individual assemblies ####################
For ($i=0; $i -lt 5; $i++)
{
echo "Adding Assembly..."$assemblyNamesArray[$i]
$dependentAssembly = New-Object $spWebConfigModClass
$dependentAssembly.Path=$dependentAssemblyPath
$dependentAssembly.Sequence =0 # First item to be inserted
$dependentAssembly.Owner = $configOwnerName
$dependentAssembly.Name =$dependentAssemblyNameStart + $assemblyNamesArray[$i] + $dependentAssemblyNameEnd
$dependentAssembly.Type = 0 #Ensure Child Node
$dependentAssembly.Value = $dependentAssemblyValueStart + $assemblyNamesArray[$i] + $dependentAssemblyValueEnd
$webService.WebConfigModifications.Add($dependentAssembly)
}
###############################################################
echo "Saving Web Config Modification"
$webService.Update()
$webService.ApplyWebConfigModifications()
echo "Update Complete"
Change this
headers:
{
"accept": "application/json",
},
Try This
headers:
{
"accept": "application/json;odata=verbose",
},

expand=fields($select=***,****) on the SharePoint Graph resource doesn't work and how about filtering?

I'm playing with the microsoft graph and especially the sharepoint beta api and i am constantly running into issues. I know its beta, but still;)
I'm getting out my expanded fields but i'm not able to select other than id.
/items?expand=fields(select=id) <-- works
/items?expand=fields(select=Title) <-- fails with response being
{
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "f460cded-46da-468c-a027-f027707a62fc",
"date": "2017-05-10T09:00:10"
}
}
}
Further on trying to filter the request with the request /items?expand=fields&$filter=fields/id eq '421' doesn't work and after a long period just returns a response without taken the filter into account.
Can someone respond if the experience the same or if my syntax is wrong or whatever would be nice. Thanks in advance. Ole Bergtun
i changed /items?expand=fields(select=Title) to /items?expand=fields(select%3DTitle) and it works for me.

Paypal Sandbox INTERNAL_SERVICE_ERROR

I am a little confused at the moment i am trying to charge a credit card in sandbox mode on PayPal's Rest SDK.
When i attempt to take payment i am getting the following response:
{
"status": 500,
"duration_time": 124,
"body": {
"message": "An internal service error occurred.",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR",
"name": "INTERNAL_SERVICE_ERROR",
"debug_id": "1d327d8a79044"
},
"additional_properties": {},
"header": {
"Content-Length": "209",
"Content-Language": "*",
"X-SLR-RETRY": "500",
"CORRELATION-ID": "1d327d8a79044",
"Date": "Thu, 14 Jul 2016 16:49:14 GMT",
"Connection": "close",
"Paypal-Debug-Id": "1d327d8a79044",
"PROXY_SERVER_INFO": "host\u003dslcsbplatformapiserv3001.slc.paypal.com;threadId\u003d200",
"Content-Type": "application/json"
}
}
I am unable to find anymore information on this, I've searched various places and seen a few suggestions ive tried such as negative testing on/off and that made no difference at all.
Any help would be apreciated,
Regarding "INTERNAL_SERVICE_ERROR", in sandbox environment, the testing credit card in your API request is a generic one and there are lots of accounts attached to this credit card, when PayPal execute your API request, we need to load all the related accounts during transaction, so it caused time out error and internal service error, please try some rarely used card number, such as below:
VISA 16 digit
4916339731576481
4916037567876898
4024007171154213
4532782720397175
4556654893065114
4539432483175995
4716339122298416
4532325401406798
4539157680503828
4124138105007679
4485178251029161
4916231960500037
4058178241644969
Please have a try.

Resources