2015-04-03 32 views
0

我可以使用步驟here來調用SalesForce。但是,當我嘗試使用獨立Web客戶端like this one撥打電話時,出現錯誤。錯誤在下面。提供給login()的用戶名和(密碼+令牌)是有效的。如何通過獨立的SOAP客戶端調用SalesForce SOAP方法

我不知道爲什麼我無法從獨立的SOAP客戶端調用SOAP方法。我相信我應該能夠。我是否必須始終使用Force-wsc連接到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> 

響應

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() 

客戶端截圖:

enter image description here

回答

0

我能想到的也許是您要發送的調用錯誤的URL唯一線路105?它是測試還是生產組織?

0

您的xml請求很好。只需檢查端點(如果您正在使用生產wsdl,請使用生產憑證,並且沙盒上的相同)或只更改服務的端點。如果您位於代理之後,我建議您查看您的.Net Web服務工作室設置以在其中設置代理設置。

希望這會有所幫助