Skip to main content
 首页 » 编程设计

c#之SalesForce Web 服务之请求元素未被识别

2024年01月01日42虾米姐

我们正在使用来自 SalesForce 的出站通知服务。

从 SalesForce WSDL 生成代理并尝试将其发送到我的 ASMX Web 服务后,我收到以下错误

请求元素 http://soap.sforce.com/2005/09/outbound'> 未被识别。

在我的 C# ASMX 网络服务上

[WebService(Namespace = "http://services.company1.com.au/services")] 
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
[ToolboxItem(false)] 
[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)] 
public class ImportPosition : WebService, NotificationPort 

SalesForce WSDL 具有以下 soap 定义

<definitions targetNamespace="http://soap.sforce.com/2005/09/outbound" 
         xmlns="http://schemas.xmlsoap.org/wsdl/" 
         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
         xmlns:tns="http://soap.sforce.com/2005/09/outbound" 
         xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
         xmlns:ent="urn:enterprise.soap.sforce.com" 
         xmlns:ens="urn:sobject.enterprise.soap.sforce.com"> 

如果我将 C# ASMX Web 服务命名空间更改为“http://soap.sforce.com/2005/09/outbound” ' 请求成功进入,但作为空对象。

使用 Wireshark 我可以看到传入的 SOAP 消息

<notifications xmlns="http://soap.sforce.com/2005/09/outbound" 

知道是什么导致了这个命名空间问题吗?谢谢

请您参考如下方法:

原来我使用了错误的工具来生成我的代理。

我应该一直使用 wsdl.exe 而不是 svcutil.exe

创建 Web 服务以接收来自 SalesForce 的出站通知的提示

use .asmx  
WS-I Basic Profile 1.1  
Web Service Description Language (WSDL) 1.1 
Simple Object Access Protocol (SOAP) 1.1