-2

从我的 WSDL 我有以下服务部分:

<service name="BAPI_CUSTOMER_DISPLAYService">
  <documentation>SAP Service BAPI_CUSTOMER_DISPLAY via SOAP</documentation>
  <port name="BAPI_CUSTOMER_DISPLAYPortType" binding="s0:BAPI_CUSTOMER_DISPLAYBinding">
    <soap:address location="http://2.3.4.100:8000/sap/bc/soap/rfc"/>
  </port>
</service>

那么什么是端点参考呢?

我在我的 salesforce 客户端中将它作为“http://2.3.4.100:8000/sap/bc/soap/rfc”给出,它给出了以下错误。“此服务需要客户端证书进行身份验证程序。”

我确信我需要提供用户名和密码,但我不知道如何在我的客户端(Apex 代码)中设置它们。

帮助表示赞赏。

4

1 回答 1

0

我导入了企业 WSDL 并使用了 loginResult 中的 uri。这是我项目中的一些代码:

LoginResult loginResult = null; // Login Result (save and make static)
SessionHeader sessionHeader = null; // Session Header (save and make static)
SoapClient soapClient = null; // This is the Enterprise WSDL
SecureStatusClient SecureStatusClient = null; // This is my custom @WebService

// Create Login Request
LoginScopeHeader loginScopeHeader = new LoginScopeHeader
{
    organizationId = configuration["OrganizationId"],
    portalId = configuration["PortalId"]
};

// Call Login Service
string userName = configuration["UserName"];
string password = configuration["Password"];
string securityToken = configuration["SecurityToken"];
using (SoapClient loginClient = new SoapClient())
{
    loginResult = loginClient.login(loginScopeHeader, userName, password + securityToken);

    if (result.passwordExpired)
    {
        string message = string.Format("Salesforce.com password expired for user {0}", userName);
        throw new Exception(message);
    }
}

// Create the SessionHeader
sessionHeader = new SessionHeader { sessionId = loginResult.sessionId };

// Create the SoapClient to use for queries/updates
soapClient = new SoapClient();
soapClient.Endpoint.Address = new EndpointAddress(loginResult.serverUrl);

// Create the SecureStatusServiceClient 
secureStatusClient = new SecureStatusServiceClient();
Uri apexUri = new Uri(SoapClient.Endpoint.Address.Uri, "/services/Soap/class/SecureStatusService");
secureStatusClient.Endpoint.Address = new EndpointAddress(apexUri);
于 2011-08-16T19:57:17.027 回答