理想情况下,需要提取网站的xls格式的所有发票,并将其存储在SharePoint中。我正在使用Docker拉取python代码,firefox和gecko驱动程序。 当我调用逻辑应用程序http触发器时,它给出了超时错误,但是所有发票都可以存储在Sharepoint逻辑应用程序中,但是运行失败。 在2分钟的限制内,给出成功的结果(触发历史记录被触发)。
我正在使用HTTP触发器和功能应用程序URL。
如何使用Webhook或任何其他解决方案来调用长期运行的逻辑应用程序成功结果。
答案 0 :(得分:0)
根据您的要求,您可以在逻辑应用程序中使用“ HTTP Webhook”。但是,您还需要修改功能代码。 Here提供了示例代码供您参考。该示例不是azure函数,但是您可以引用它来修改函数代码。请注意下面的示例code。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
namespace LogicAppTriggers.Controllers
{
public class WebhookTriggerController : ApiController
{
public static List<string> subscriptions = new List<string>();
/// <summary>
/// Recieve a subscription to a webhook.
/// </summary>
/// <param name="callbackUrl">URL to get from Logic Apps - @listCallbackUrl()</param>
/// <returns></returns>
[HttpPost, Route("api/webhooktrigger/subscribe")]
public HttpResponseMessage Subscribe([FromBody] string callbackUrl)
{
subscriptions.Add(callbackUrl);
return Request.CreateResponse();
}
/// <summary>
/// Fire all triggers - do a GET to this API to fire all triggers subscribed
/// </summary>
/// <returns></returns>
[HttpGet, Route("api/webhooktrigger/trigger")]
public async Task<HttpResponseMessage> Get()
{
using (HttpClient client = new HttpClient())
{
foreach (string callbackUrl in subscriptions)
await client.PostAsync(callbackUrl, @"{""trigger"":""fired""}", new JsonMediaTypeFormatter(), "application/json");
}
return Request.CreateResponse(HttpStatusCode.Accepted, String.Format("There are {0} subscriptions fired", subscriptions.Count));
}
/// <summary>
/// Unsubscribe
/// </summary>
/// <param name="callbackUrl"></param>
/// <returns></returns>
[HttpPost, Route("api/webhooktrigger/unsubscribe")]
public HttpResponseMessage Unsubscribe([FromBody] string callbackUrl)
{
subscriptions.Remove(callbackUrl);
return Request.CreateResponse();
}
}
}
然后您可以使用“ HTTP Webhook”,如下所示: