发送失败原因 SalesForce 出站消息

Delivery Failure Reason SalesForce Outbound Message

我的工作流程 运行 出站消息有:

Endpoint URL    http://testservices.com/Pixel/Send

   Fields to Send:
  AffiliateData__c AffiliateID__c EmailIdLead_ID__c

  Send Session ID : not secelted

I don't use Endpoint WSDL. Is it ok or i habe to implimat it for returmn status to saleforce?

我的服务发送一些像素,然后 return "true" 或 "false" 作为字符串。

出站消息出现错误

Delivery Failure Reason : org.xml.sax.SAXException: Bad envelope tag: string

我需要什么 return 出站消息不会出错?或者我必须实施 wsdl?

saleforse outbound massadge 期望在发送格式为 xml (soapenv:Envelope) 且为 true 的消息后得到响应。

在您的函数末尾,您需要添加此

        [Route("Send")]
        [HttpPost]
        [HttpGet]
        [WebMethod]
        [SoapDocumentMethod]
        public HttpResponseMessage Send(HttpRequestMessage request)
        {
            //you code


     //at the end add this
     XmlDocument soapEnvelop = new XmlDocument();
     soapEnvelop.LoadXml(@"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><soapenv:Body><notifications xmlns=""http://soap.sforce.com/2005/09/outbound""> <Ack>true</Ack></notifications></soapenv:Body></soapenv:Envelope>");

                return new HttpResponseMessage()
                 {
                     RequestMessage = Request,
                     Content = new XmlContent(soapEnvelop)
                 };

Class 对于 return 类型

public class XmlContent : HttpContent
    {
        private readonly MemoryStream _Stream = new MemoryStream();

        public XmlContent(XmlDocument document)
        {
            document.Save(_Stream);
            _Stream.Position = 0;
            Headers.ContentType = new MediaTypeHeaderValue("application/xml");
        }

        protected override Task SerializeToStreamAsync(Stream stream, System.Net.TransportContext context)
        {
            _Stream.CopyTo(stream);
            var tcs = new TaskCompletionSource<object>();
            tcs.SetResult(null);
            return tcs.Task;
        }

        protected override bool TryComputeLength(out long length)
        {
            length = _Stream.Length;
            return true;
        }

        protected override void Dispose(bool disposing)
        {
            if (_Stream != null)
                _Stream.Dispose();
        }
    }