Web services 如何通过独立的SOAP客户端调用SalesForce SOAP方法

Web services 如何通过独立的SOAP客户端调用SalesForce SOAP方法,web-services,soap,salesforce,soapui,soap-client,Web Services,Soap,Salesforce,Soapui,Soap Client,我可以使用步骤给SalesForce打电话。然而,当我尝试使用独立的web客户机进行调用时,会出现错误。错误如下。提供给login()的用户名和(密码+令牌)有效 我不知道为什么我不能从独立的SOAP客户端调用SOAP方法。我相信我能做到。我是否必须始终使用连接到SalesForce 请求: <?xml version="1.0" encoding="utf-16"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/

我可以使用步骤给SalesForce打电话。然而,当我尝试使用独立的web客户机进行调用时,会出现错误。错误如下。提供给login()的用户名和(密码+令牌)有效

我不知道为什么我不能从独立的SOAP客户端调用SOAP方法。我相信我能做到。我是否必须始终使用连接到SalesForce

请求:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <login xmlns="urn:enterprise.soap.sforce.com">
      <username>MY_USERNAME</username>
      <password>PASSWORD+TOKEN</password>
    </login>
  </soap:Body>
</soap:Envelope>
客户端屏幕截图:


连接器使用的是会话头,而不是用户名和密码,因此您可以生成SF会话并在独立客户端设置中输入头。 看这里的105行


我能想到的唯一一件事是,也许你把电话发送到了错误的url?它是测试组织还是生产组织?

您的xml请求没有问题。只需检查端点(如果您使用的是生产wsdl,请使用生产凭据,对于沙盒也是如此,或者只需更改服务的端点)。如果您支持代理,我建议您查看.Net webservice studio设置,以便在那里设置代理设置

希望这有帮助

ResponseCode: 500 (Server Error)
Transfer-Encoding:chunked
Content-Type:text/xml;charset=UTF-8
Date:Fri, 03 Apr 2015 16:25:47 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie:BrowserId=KUXkegaIQ_aJnfVrQEeC-A;Path=/;Domain=.salesforce.com;Expires=Tue, 02-Jun-2015 16:25:47 GMT

<?xml version="1.0" encoding="utf-16"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>INVALID_LOGIN</faultcode>
      <faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring>
      <detail>
        <sf:LoginFault xsi:type="sf:LoginFault">
          <sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode>
          <sf:exceptionMessage>Invalid username, password, security token; or user locked out.</sf:exceptionMessage>
        </sf:LoginFault>
      </detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>
    ************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Web.Services.Protocols.SoapException: INVALID_LOGIN: Invalid username, password, security token; or user locked out.
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at SforceService.login(String username, String password)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at WebServiceStudio.MainForm.InvokeWebMethod()
                SessionRenewer.SessionRenewalHeader sessionHeader = config.getSessionRenewer().renewSession(config);
                if (sessionHeader != null) {
                    addHeader(sessionHeader.name, sessionHeader.headerElement);
                }