SOAP请求必须使用SOAP 1.1,没有收到SOAP 1.1 Envelope作为文档根

时间:2018-05-14 12:17:52

标签: salesforce salesforce-service-cloud salesforce-communities

我正在尝试使用CURL command.my文件job.txt创建批量API作业如下 -

<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>Query</operation>
<object>account</object>
<contentType>CSV</contentType>
</jobInfo> 

curl命令如下 -

curl https://XXXXX.salesforce.com/services/Soap/u/42.0 -H "X-SFDC-Session:XXXXXXXXX" -H "Content-Type: text/xml; charset=UTF-8" -H "SoapAction":Query -d @job.txt 

但是当我执行上述命令时,我收到如下错误 -

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://shemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapev:VersionMismatch</faultcode><faultstring>The SOAP request must use SOAP 1.1, did not recieve a SOAP 1.1 Envelope as the document root</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>

我是SFDC bulk api的新手

1 个答案:

答案 0 :(得分:2)

您正在调用SOAP端点,您应该在其中调用REST端点(或在SOAP端点上使用SOAP请求)。

我认为您正在使用此示例:https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_code_curl_walkthrough.htm。如果是这种情况,您使用的是错误的请求网址。请尝试使用/services/async/42.0/job代替/services/Soap/u/42.0