问题描述
我正在尝试通过 SalesForce 的 SOAP API 完成验证 SessionID(我已经拥有)的简单任务.问题是,我在网上找到的所有例子都是这样的:
I'm trying to accomplishing a simple task of validating a SessionID (that I already have) through the SOAP API of SalesForce. Problem is, all the examples I found on internet is like this:
SforceService binding = new SforceService();
binding.Url = serverUrl;
binding.SessionHeaderValue = new SessionHeader();
binding.SessionHeaderValue.sessionId = sessionId;
但是对于第一行对我来说不起作用,我已经通过 Visual Studio 和 WSDL 文件添加了 Web 参考,这些文件是通过我在 salesforce 上的帐户下载的.但 SforceService 是一个无法实例化的命名空间.
but for the very first line doesn't work for me, I've added the web reference through Visual Studio and WSDL file that I've downloaded through my account on salesforce. but SforceService is a namespace that can't be instantiated.
这是添加引用后我的解决方案资源管理器的样子:
this is how my Solution Explorer looks like after adding the reference:
我只想验证一个 SessionID!!
All I want to is to validate a SessionID!!
有什么想法吗?
推荐答案
您添加了服务引用,而不是 Web 引用,您需要通过高级按钮选择 Web 引用.(或者您应该能够使用服务引用来使其工作,但编程模型不同,因此您正在查看的示例不适用)
You added a service reference, not a web reference, you need to go through the advanced button and pick web reference instead. (Or you should be able to get it to work with a service reference, but the programming model is different, so the samples you're looking at don't apply)
这篇关于SFService 是一个“命名空间",但用作类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!