• igress
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
Hi,
I am using Bulk API (with XML) with C# I have created a new job and uploaded a batch (xml) file. When i try to close the job the API returns 400 Bad Request. The data is being uploaded to the Saleforce but the jib is not getting closed. 

Here is the code I am using to close the job.
 
var jobRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><jobInfo xmlns=\"http://www.force.com/2009/06/asyncapi/dataload\"><state>Closed</state></jobInfo>";

var restEndPoint="https://xxxx.salesforce.com/services/async/33.0/job/JobId";

var webClient = new BulkApiWebClient { Encoding = Encoding.UTF8 };

webClient.Headers.Add("X-SFDC-Session: sdfsadfsdf-sdfsdfadsfasdf-asdfasdfasdfsdfasdf");
webClient.Headers.Add("Content-Type: application/xml");
var response=webClient.UploadString(restEndPoint, "Post", jobRequest);
I am receiving 400 Bad Request error.
However when I send it through cURL I am able to close the job and I am getting back a response.
 
curl https://xxxx.salesforce.com/services/async/33.0/job/75029000000BM5t 
-H "X-SFDC-Session:sdfsadfsdf-sdfsdfadsfasdf-asdfasdfasdfsdfasdf" 
-H "Content-Type: application/xml; charset=UTF-8" 
-d "@C:\closejob.txt"
closejob.txt has the same jobRequest string <?xml version=\"1.0\" encoding=\"UTF-8\"?><jobInfo xmlns=\"http://www.force.com/2009/06/asyncapi/dataload\"><state>Closed</state></jobInfo>

Thanks
  • January 14, 2016
  • Like
  • 0
Hi ,
Since Salesforce Disabling TLS 1.0 Encryption, I am using .NET Framework 4.0 Webclient class to connect to salesforce. 

var _webClient=new WebClient();
var content = new System.Collections.Specialized.NameValueCollection
            {
                {"grant_type", "password"},
                {"client_id", clientId},
                {"client_secret", clientSecret},
                {"username", username},
                {"password", password}
            };
var responseBytes = _webClient.UploadValues(tokenRequestEndpointUrl, "POST", content);
var responseBody = Encoding.UTF8.GetString(responseBytes);

I know that System.Net.ServicePointManager.SecurityProtocol (https://msdn.microsoft.com/en-us/library/system.net.securityprotocoltype(v=vs.100).aspx)supports Tls (which is default choice) . But as you look at the link it says it is TLS1.0 protocol. How do I specify TLS1.1 and higher.

I cannot upgrade my existing solution to .NET4.5 since it is a huge undertaking. Is upgrading to .NET4.5 the only way because I see System.Net.ServicePointManager.SecurityProtocol (https://msdn.microsoft.com/en-us/library/system.net.securityprotocoltype(v=vs.110).aspx) supports TLS1.1 and 1.2.

Thanks

Related post: https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BMX0IAO
Hi ,
Since Salesforce Disabling TLS 1.0 Encryption, I am using .NET Framework 4.0 Webclient class to connect to salesforce. 

var _webClient=new WebClient();
var content = new System.Collections.Specialized.NameValueCollection
            {
                {"grant_type", "password"},
                {"client_id", clientId},
                {"client_secret", clientSecret},
                {"username", username},
                {"password", password}
            };
var responseBytes = _webClient.UploadValues(tokenRequestEndpointUrl, "POST", content);
var responseBody = Encoding.UTF8.GetString(responseBytes);

I know that System.Net.ServicePointManager.SecurityProtocol (https://msdn.microsoft.com/en-us/library/system.net.securityprotocoltype(v=vs.100).aspx)supports Tls (which is default choice) . But as you look at the link it says it is TLS1.0 protocol. How do I specify TLS1.1 and higher.

I cannot upgrade my existing solution to .NET4.5 since it is a huge undertaking. Is upgrading to .NET4.5 the only way because I see System.Net.ServicePointManager.SecurityProtocol (https://msdn.microsoft.com/en-us/library/system.net.securityprotocoltype(v=vs.110).aspx) supports TLS1.1 and 1.2.

Thanks
I have a custom rest end point that I created using Apex Class. I call this rest end point from my app every time a new account is created. If 100 accounts are created I make 100 API calls. 
I want to use Bulk API so that I can avoid individual calls every time an account is created. I need to use my MyRestEndPoint because it has some business logic inside it which does extra processing apart from upserting the account.

@RestResource(urlMapping='/MyRestEndPoint')
global with sharing class MyRestEndPointClass {
    @HttpPost
    global static String doPost(Account account){            
        //Custom code - 

        return 'something'
    }   
}

Any help is much appreciated

Thanks
Hi ,
Since Salesforce Disabling TLS 1.0 Encryption, I am using .NET Framework 4.0 Webclient class to connect to salesforce. 

var _webClient=new WebClient();
var content = new System.Collections.Specialized.NameValueCollection
            {
                {"grant_type", "password"},
                {"client_id", clientId},
                {"client_secret", clientSecret},
                {"username", username},
                {"password", password}
            };
var responseBytes = _webClient.UploadValues(tokenRequestEndpointUrl, "POST", content);
var responseBody = Encoding.UTF8.GetString(responseBytes);

I know that System.Net.ServicePointManager.SecurityProtocol (https://msdn.microsoft.com/en-us/library/system.net.securityprotocoltype(v=vs.100).aspx)supports Tls (which is default choice) . But as you look at the link it says it is TLS1.0 protocol. How do I specify TLS1.1 and higher.

I cannot upgrade my existing solution to .NET4.5 since it is a huge undertaking. Is upgrading to .NET4.5 the only way because I see System.Net.ServicePointManager.SecurityProtocol (https://msdn.microsoft.com/en-us/library/system.net.securityprotocoltype(v=vs.110).aspx) supports TLS1.1 and 1.2.

Thanks

Related post: https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BMX0IAO
Hi,
I am using Bulk API (with XML) with C# I have created a new job and uploaded a batch (xml) file. When i try to close the job the API returns 400 Bad Request. The data is being uploaded to the Saleforce but the jib is not getting closed. 

Here is the code I am using to close the job.
 
var jobRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><jobInfo xmlns=\"http://www.force.com/2009/06/asyncapi/dataload\"><state>Closed</state></jobInfo>";

var restEndPoint="https://xxxx.salesforce.com/services/async/33.0/job/JobId";

var webClient = new BulkApiWebClient { Encoding = Encoding.UTF8 };

webClient.Headers.Add("X-SFDC-Session: sdfsadfsdf-sdfsdfadsfasdf-asdfasdfasdfsdfasdf");
webClient.Headers.Add("Content-Type: application/xml");
var response=webClient.UploadString(restEndPoint, "Post", jobRequest);
I am receiving 400 Bad Request error.
However when I send it through cURL I am able to close the job and I am getting back a response.
 
curl https://xxxx.salesforce.com/services/async/33.0/job/75029000000BM5t 
-H "X-SFDC-Session:sdfsadfsdf-sdfsdfadsfasdf-asdfasdfasdfsdfasdf" 
-H "Content-Type: application/xml; charset=UTF-8" 
-d "@C:\closejob.txt"
closejob.txt has the same jobRequest string <?xml version=\"1.0\" encoding=\"UTF-8\"?><jobInfo xmlns=\"http://www.force.com/2009/06/asyncapi/dataload\"><state>Closed</state></jobInfo>

Thanks
  • January 14, 2016
  • Like
  • 0