简体   繁体   English

如何从WebHookHandler获取基础SOAP文档

[英]How do I get the underlying SOAP document from a WebHookHandler

I'm trying to get the underlying SOAP document that this webhook handler is receiving 我正在尝试获取此webhook处理程序正在接收的基础SOAP文档

public class Myclass: WebHookHandler
{

    public override Task ExecuteAsync(string receiver, WebHookHandlerContext context)
    {

        var f = context.Request.Content.ReadAsStringAsync().Result;
             // this returns a blank string

        return Task.FromResult(true);
    }
}

Furthermore, most of the handlers in the Request object seem to be suspiciously blank. 此外,Request对象中的大多数处理程序似乎都可空白。

After some work, I've found that in the case of a Salesforce webhook, the underlying soap message can be achieved by typecasting the context.Data value to the SalesforceNotifications object that comes alone with the Salesforce Webhook library. 经过一些工作后,我发现对于Salesforce Webhook,可以通过将context.Data值类型转换为Salesforce Webhook库随附的SalesforceNotifications对象来获得基本的肥皂消息。

           var msg = (SalesforceNotifications) context.Data;   
           var soapmsg = msg.Document;

But this assumes that the message is caught and properly handled. 但是,这假定已捕获并正确处理了消息。 It doesn't really answer my original question. 它并不能真正回答我的原始问题。 I'm still looking for the answer of how I can intercept the HTTP message before it gets parsed and chopped up. 我仍在寻找在解析和切碎HTTP消息之前如何拦截HTTP消息的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM