Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3444340
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:54:11+00:00 2026-05-18T08:54:11+00:00

I am trying to connect to the SalesForce.com bulk API so I can do

  • 0

I am trying to connect to the SalesForce.com bulk API so I can do mass uploads of data from my application. I have read through the PDF documentation which emphasizes using CURL to make the POST requests. In keeping with the instructions, I have created a text file in XML format which is used for logging into the server.

Login.txt contents below:

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
     <n1:login xmlns:n1="urn:partner.soap.sforce.com">
            <n1:username>my username</n1:username>
         <n1:password>my password</n1:password>
     </n1:login>
     </env:Body>
</env:Envelope>

Here is what I’m trying to do in my code to make the login request:

XmlDocument XMLResponse = null;

HttpWebRequest httpRequest;

HttpWebResponse httpResponse = null;

Stream requestStream = null;
Stream responseStream = null;

XmlTextReader xmlReader;

httpRequest = HttpWebRequest)WebRequest.Create("https://login.salesforce.com/services/Soap/c/20.0");

try
{
            byte[] bytes = File.ReadAllBytes(filename);
            httpRequest.Method = "POST";
            httpRequest.ContentLength = bytes.Length;
            httpRequest.ContentType = "text/xml; charset=UTF-8";
            httpRequest.Headers.Add("SOAPAction: login");
            requestStream = httpRequest.GetRequestStream();
            requestStream.Write(bytes, 0, bytes.Length);
            requestStream.Close();

            httpResponse = (HttpWebResponse)httpRequest.GetResponse();

            if (httpResponse.StatusCode == HttpStatusCode.OK)
            {
                responseStream = httpResponse.GetResponseStream();

                xmlReader = new XmlTextReader(responseStream);

                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(xmlReader);

                XMLResponse = xmldoc;
                xmlReader.Close();
            }

            httpResponse.Close();
}

When this code executes I always get a 500 error. Does anyone have any experience in doing what I am attempting to do? Could you please provide me with some suggestions?

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:54:12+00:00Added an answer on May 18, 2026 at 8:54 am

    For the login part, just download and import the partner WSDL and use the generated web service client. Otherwise, you’ll want to update your code to read the response when it gets a 500 status code (the SOAP spec requires fault messages to use a 500 status code), the response body will give you more clues to the problem. I’d expect in this case you’re getting an identity confirmation error, and you’ll need to provide your api security token in addition to your password in the login request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.