【问题标题】:How can I switch between "test" and "production" Salesforce Enterprise WSDL web reference classes?如何在“测试”和“生产”Salesforce Enterprise WSDL Web 参考类之间切换?
【发布时间】:2020-03-25 21:17:43
【问题描述】:

我已经在我的 Visual Studio 控制台项目中使用 WSDL 文件为 Salesforce 生产和 Salesforce 沙箱创建了 Web 引用。

我正在尝试这样编写程序:

ServiceClass client;
if(Debug)
{
     client = Test.SforceService;
}
else
{
     client = Prod.SforceService;
}

问题是,SforceService 类是自动生成的,所以我无法在他们的文件中实现 ServiceClass。

我有什么选择?

【问题讨论】:

  • wsdl 文件有区别吗?
  • 是的,在很多地方。
  • 如果它们是准确的,您根本不必在类之间切换。这就是我问的原因。

标签: c# wsdl salesforce web-reference


【解决方案1】:

当您最后检查 WSDL 时,应该是这样的:

<service name="SforceService">
    <documentation>Sforce SOAP API</documentation>
    <port binding="tns:SoapBinding" name="Soap">
        <soap:address location="https://test.salesforce.com/services/Soap/u/48.0"/>
    </port>
</service>

我的 C# 时代已经一去不复返了,但尝试在生成的类中寻找匹配的部分。如果它是一个字符串属性,您应该能够在运行时使用login.salesforce.com(或其他方式)覆盖默认值?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-14
    • 2018-05-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多