12 April 2015

Sample Salesforce Enterprise SOAP login

This is a sample SOAP Login using Enterprise WSDL. Note that we are not passing any header information here for the sake of example.


<soapenv:Envelope 
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>replace this with our SFDC username</urn:username>
         <urn:password>password + security token</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

Below is the sample SOAP response:


<soapenv:Envelope 
     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
     xmlns="urn:partner.soap.sforce.com" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <loginResponse>
         <result>
            <metadataServerUrl>
               https://na5.salesforce.com/services/Soap/m/30.0/00D700000008fqn
            </metadataServerUrl>
            <passwordExpired>false</passwordExpired>
            <sandbox>false</sandbox>
            <serverUrl>
              https://na5.salesforce.com/services/Soap/u/30.0/00D700000008fqn
             </serverUrl>
            <sessionId>REMOVED</sessionId>
            <userId>005700000012RyAAAU</userId>
            <userInfo>
               <accessibilityMode>false</accessibilityMode>
               <currencySymbol>$</currencySymbol>
               <orgAttachmentFileSizeLimit>5242880</orgAttachmentFileSizeLimit>
               <orgDefaultCurrencyIsoCode>USD</orgDefaultCurrencyIsoCode>
               <orgDisallowHtmlAttachments>false</orgDisallowHtmlAttachments>
               <orgHasPersonAccounts>true</orgHasPersonAccounts>
               <organizationId>00D700000008fqnEAA</organizationId>
               <organizationMultiCurrency>false</organizationMultiCurrency>
               <organizationName>REMOVED</organizationName>
               <profileId>00e70000000sEkZAAU</profileId>
               <roleId>00E70000000olJBEAY</roleId>
               <sessionSecondsValid>7200</sessionSecondsValid>
               <userDefaultCurrencyIsoCode xsi:nil="true"/>
               <userEmail>REMOVED/userEmail>
               <userFullName>REMOVED</userFullName>
               <userId>005700000012RyAAAU</userId>
               <userLanguage>en_US</userLanguage>
               <userLocale>en_US</userLocale>
               <userName>REMOVED</userName>
               <userTimeZone>America/Los_Angeles</userTimeZone>
               <userType>Standard</userType>
               <userUiSkin>Theme3</userUiSkin>
            </userInfo>
         </result>
      </loginResponse>
   </soapenv:Body>
</soapenv:Envelope>

NOTE:

The following is important on your succeeding calls using SOAP
  • sessionId: This is the value you would need to pass to succeeding SOAP calls as this proves that you are authenticated.
  • serverUrl:  This will be the URL you will need to post succeeding SOAP calls.
please see my blogpost for doing SOAP integration using Partner WSDL.


3 comments:

  1. Hi,
    The blog is informative and helpful:)
    I need one clarification please. It looks like the Salesforce WSDL used here is 30.0. But when i created developer edition salesforce account to download enterprise WSDL I got latest WSDL(version 34.0). But my integration tool supports older version(30.0 or below) to integrate with Salesforce cloud.
    Please suggest how I can get the same...

    ReplyDelete
  2. I don't think you will be able to select the version when you generate the file but if you manually update the versiin from the WSDL itself it might work as it supposed to be backward compatible. What kind od middleware you are using? Anyway let me know!

    ReplyDelete
  3. Excellent information with unique content and it is very useful to know about the information based on blogs.this is valuable information for learners.thanks
    http://hadooptraininginhyderabad.co.in/salesforce-training-in-hyderabad/

    ReplyDelete