Creating Case record using Salesforce SOAP API using Enterprise WSDL

Creating Case record using Salesforce SOAP API using Enterprise WSDL

1. Do Login request and get the Session Id.

Request URL:

https://login.salesforce.com/services/Soap/c/55.0

Request Body:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:LoginScopeHeader>
         <urn:organizationId>00D8c0000015heN</urn:organizationId>
      </urn:LoginScopeHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username><Your Username></urn:username>
         <urn:password><Your Password></urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

2. Do a create request to create the Case record.

Request URL:

https://d8c0000015heneaq-dev-ed.my.salesforce.com/services/Soap/c/55.0/0DF8c000000Tam4

Request Body:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:SessionHeader>
         <urn:sessionId>
         	00D8c0000015heN!AQkAQIzbd4MRQvfPQsq79RyOFBAdhKvz_HXZxo6dCm6p
         </urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:create>
		<urn1:sObjects xsi:type="Case" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <Type>Other</Type>          
            <Subject>Testing</Subject>
            <Status>New</Status>
            <Origin>Web</Origin>Origin>
            <urn1:RecordType><urn1:Name>Service Request</urn1:Name></urn1:RecordType>
         </urn1:sObjects>
      </urn:create>
   </soapenv:Body>
</soapenv:Envelope>

Output:

Leave a Reply