function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mahesh1.396434879374128E12mahesh1.396434879374128E12 

How to create an account record from Enterprise wsdl(Default create Method) using soap UI

Best Answer chosen by mahesh1.396434879374128E12
Vinit_KumarVinit_Kumar
You just need to send the field values required to create an Account record.If you don't have any custom validation rule,only send value for for Name field of account.

In response you will get the Id of account created.

Your Sample SOAP request should be something like below :-

POST /services/Soap/c/5.0 HTTP/1.0  
Content-Type: text/xml; charset=utf-8  
Accept: application/soap+xml, application/dime, multipart/related, text/*  
User-Agent: Axis/1.1  
Host: na1.salesforce.com  
Cache-Control: no-cache  
Pragma: no-cache  
SOAPAction: ""  
Content-Length: 2200   
 
<?xml version="1.0" encoding="UTF-8"?> 
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance">  
      <soapenv:Header>   
         <ns1:SessionHeader soapenv:mustUnderstand="0" 
xmlns:ns1="urn:enterprise.soap.sforce.com">    
            <ns2:sessionId 
xmlns:ns2="urn:enterprise.soap.sforce.com">WgMUbbkPm_jXlNKOSU</ns2:sessionId>   
         </ns1:SessionHeader>  
      </soapenv:Header>  
      <soapenv:Body>   
         <create xmlns="urn:enterprise.soap.sforce.com">    
            <sObjects xsi:type="ns3:Account" 
xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">     
               <ns3:AccountNumber>0000000</ns3:AccountNumber>     
               <ns3:BillingCity>Wichita</ns3:BillingCity>     
               <ns3:BillingCountry>US</ns3:BillingCountry>     
               <ns3:BillingPostalCode>87901</ns3:BillingPostalCode>     
               <ns3:BillingState>KA</ns3:BillingState>     
               <ns3:BillingStreet>4322 Haystack Boulevard</ns3:BillingStreet>     
               <ns3:Description>World class hay makers.</ns3:Description>     
               <ns3:Fax>555.555.5555</ns3:Fax>     
               <ns3:Industry>Farming</ns3:Industry>     
               <ns3:Name>Golden Straw</ns3:Name>     
               <ns3:NumberOfEmployees>40</ns3:NumberOfEmployees>     
               <ns3:Ownership>Privately Held</ns3:Ownership>     
               <ns3:Phone>666.666.6666</ns3:Phone>     
               <ns3:Website>www.oz.com</ns3:Website>    
            </sObjects>    
         </create>  
      </soapenv:Body> 
   </soapenv:Envelope>

Go through below link to learn more :-

https://developer.salesforce.com/page/Sample_SOAP_Messages-create

If this helps,please mark it as best answer to help others :)

All Answers

Vinit_KumarVinit_Kumar
You just need to send the field values required to create an Account record.If you don't have any custom validation rule,only send value for for Name field of account.

In response you will get the Id of account created.

Your Sample SOAP request should be something like below :-

POST /services/Soap/c/5.0 HTTP/1.0  
Content-Type: text/xml; charset=utf-8  
Accept: application/soap+xml, application/dime, multipart/related, text/*  
User-Agent: Axis/1.1  
Host: na1.salesforce.com  
Cache-Control: no-cache  
Pragma: no-cache  
SOAPAction: ""  
Content-Length: 2200   
 
<?xml version="1.0" encoding="UTF-8"?> 
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance">  
      <soapenv:Header>   
         <ns1:SessionHeader soapenv:mustUnderstand="0" 
xmlns:ns1="urn:enterprise.soap.sforce.com">    
            <ns2:sessionId 
xmlns:ns2="urn:enterprise.soap.sforce.com">WgMUbbkPm_jXlNKOSU</ns2:sessionId>   
         </ns1:SessionHeader>  
      </soapenv:Header>  
      <soapenv:Body>   
         <create xmlns="urn:enterprise.soap.sforce.com">    
            <sObjects xsi:type="ns3:Account" 
xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">     
               <ns3:AccountNumber>0000000</ns3:AccountNumber>     
               <ns3:BillingCity>Wichita</ns3:BillingCity>     
               <ns3:BillingCountry>US</ns3:BillingCountry>     
               <ns3:BillingPostalCode>87901</ns3:BillingPostalCode>     
               <ns3:BillingState>KA</ns3:BillingState>     
               <ns3:BillingStreet>4322 Haystack Boulevard</ns3:BillingStreet>     
               <ns3:Description>World class hay makers.</ns3:Description>     
               <ns3:Fax>555.555.5555</ns3:Fax>     
               <ns3:Industry>Farming</ns3:Industry>     
               <ns3:Name>Golden Straw</ns3:Name>     
               <ns3:NumberOfEmployees>40</ns3:NumberOfEmployees>     
               <ns3:Ownership>Privately Held</ns3:Ownership>     
               <ns3:Phone>666.666.6666</ns3:Phone>     
               <ns3:Website>www.oz.com</ns3:Website>    
            </sObjects>    
         </create>  
      </soapenv:Body> 
   </soapenv:Envelope>

Go through below link to learn more :-

https://developer.salesforce.com/page/Sample_SOAP_Messages-create

If this helps,please mark it as best answer to help others :)

This was selected as the best answer
mahesh1.396434879374128E12mahesh1.396434879374128E12
Hi Vinit..... 

I am still facing some issue.

Can you please check mycode, I will wait for your suggestions.

This is the Request:

<<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>
     
<ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="urn:enterprise.soap.sforce.com">
<ns2:sessionId xmlns:ns2="urn:enterprise.soap.sforce.com">00Dm00000000lfq!AQQAQBZdiW5_Wh7pVQdp4um126Kdf2M8OynqSfqR56OmdiZrER._bFe48Fvtm7Fp7e6Tj8G5xYGXIZj8hqNrUL8Bz8kZQ5bH</ns2:sessionId>  
        </ns1:SessionHeader> 
   </soapenv:Header>
      <soapenv:Body>  
           <create xmlns="urn:enterprise.soap.sforce.com">   
              <sObjects xsi:type="ns3:Account" xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">    
                <ns3:Name>Golden Straw</ns3:Name>    
                 <ns3:CommercialName__c>Privately Held</ns3:CommercialName__c>    
             </sObjects> 
           </create> 
      </soapenv:Body>
</soapenv:Envelope>

The Response :


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>UNKNOWN_EXCEPTION</faultcode>
         <faultstring>UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService</faultstring>
         <detail>
            <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
               <sf:exceptionCode>UNKNOWN_EXCEPTION</sf:exceptionCode>
               <sf:exceptionMessage>Destination URL not reset. The URL returned from login must be set in the SforceService</sf:exceptionMessage>
            </sf:UnexpectedErrorFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>


Thanks in Advance.




Vinit_KumarVinit_Kumar
Ok,it seems you are sending the request to generic URL login.salesforce.com,istead you should be sending it to Serverl URL .

Open the WSDL file in notepad and see the Endpoint URL at the botton,you need to send request to that URL only.

Hope this helps!!
mahesh1.396434879374128E12mahesh1.396434879374128E12
I am sending it to the end point URL only like "https://test.salesforce.com/services/Soap/c/30.0/0DFb000****01rf"
Vinit_KumarVinit_Kumar
You need to send it to instance specific URL something like cs3,cs5 or whichever instance your org is on ..
mahesh1.396434879374128E12mahesh1.396434879374128E12
Thanks You Vinit.

It is working fine.
SadhuSadhu
Vinit Sir, Jairaj Jadhav here... I hope you would have recognized me...
I need your help on this topic.
I want name as well with ID in response to create request. Is it possible? I tried multiple things but it didn't work.

Please help!!!
 
Vichhay ChhengVichhay Chheng
hi mahesh,

How to get Soap envelope request and response with .net likw u above.?