Send PDF to Azure Function

veseli_oblacak
Member Posts: 4
I am trying to create azure function which will take PDF sent from BC and encrypted it with password. I try two different approach.
First, to send instream from BC with content

And azure function is like down there, but always got an error. Seams like I don't take stream parameter on azure function correct.

I also try to convert pdf to ToBase64, and send it like dictionary parameter but got error

First, to send instream from BC with content

And azure function is like down there, but always got an error. Seams like I don't take stream parameter on azure function correct.

I also try to convert pdf to ToBase64, and send it like dictionary parameter but got error

0
Answers
-
Does it work when you test it on locally?Make Simple & Easy0
-
-
You got the error but you didn’t post the error message. If you post the error messages, someone can help your issueMake Simple & Easy0
-
-
Hello @veseli_oblacak ,
This is the scaffolding created for a C# Azure Function#r "Newtonsoft.Json" using System.Net; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; using Newtonsoft.Json; public static async Task<IActionResult> Run(HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; string responseMessage = string.IsNullOrEmpty(name) ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." : $"Hello, {name}. This HTTP triggered function executed successfully."; return new OkObjectResult(responseMessage); }
And this is how the Test/Run is working.
You could try it.
Regards.0 -
Hello @veseli_oblacak ,
This is the scaffolding created for a C# Azure Function#r "Newtonsoft.Json" using System.Net; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; using Newtonsoft.Json; public static async Task<IActionResult> Run(HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; string responseMessage = string.IsNullOrEmpty(name) ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." : $"Hello, {name}. This HTTP triggered function executed successfully."; return new OkObjectResult(responseMessage); }
And this is how the Test/Run is working.
You could try it.
Regards.
This was the first code I tried and its work. But I have a problem to pass and manipulate with stream.0 -
Hello @veseli_oblacak ,
Could you post how you pass in the body request the PDF to that Azure Functrion ?
In my opinion is better send it in Base64.
Regards.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions