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
straussstrauss 

How to get XML for queryResult

I have been browsing the documentation looking for a built-in method to get the XML for queryResult, but I can't see one.  Is there an example of how to get the XML?
Gareth DaviesGareth Davies
Sorry if this is a dumb question, but why do you need to? If you use the AJAX tool-kit you can work at a higher abstraction than the raw SOAP and XML calls.
 
Gareth.
 
 
Gareth DaviesGareth Davies
but if you really want to know...
 
 
Code:
Sample Request Message-query Call-Enterprise API

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: 879   
 
<—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">WgMUbbkPmBoH_dI9Z89Nvxm6ojXlNKOSU</
ns2:sessionId>   
         </ns1:SessionHeader>   
         <ns3:QueryOptions soapenv:mustUnderstand="0" xmlns:ns3="SoapService">    
            <ns4:batchSize xmlns:ns4="urn:enterprise.soap.sforce.com">3</
ns4:batchSize>   
         </ns3:QueryOptions>  
      </soapenv:Header>  
      <soapenv:Body>   
         <query xmlns="urn:enterprise.soap.sforce.com">    
            <queryString>select FirstName, LastName from Contact</queryString>   
         </query>  
      </soapenv:Body> 
   </soapenv:Envelope> 

Sample Response Message-query Call-Enterprise API

HTTP/1.0 200 OK  
Server: sfdc  
Content-Type: text/xml; charset=utf-8  
Date: Wed, 07 Jul 2004 18:04:04 GMT   
 
<˜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:Body>   
         <queryResponse xmlns="urn:enterprise.soap.sforce.com">    
            <result>     
               <done>false</done>     
               <queryLocator>01g30000000590JAAQ-3</queryLocator>     
               <records xsi:type="sf:Contact" 
xmlns:sf="urn:sobject.enterprise.soap.sforce.com">      
                  <sf:FirstName>Merce</sf:FirstName>      
                  <sf:LastName>Carroll</sf:LastName>     
               </records>     
               <records xsi:type="sf:Contact" 
xmlns:sf="urn:sobject.enterprise.soap.sforce.com">      
                  <sf:FirstName>Jim</sf:FirstName>      
                  <sf:LastName>Jones</sf:LastName>     
               </records>     
               <records xsi:type="sf:Contact" 
xmlns:sf="urn:sobject.enterprise.soap.sforce.com">      
                  <sf:FirstName>Sydney</sf:FirstName>      
                  <sf:LastName>Carroll</sf:LastName>     
               </records>     
               <size>82</size>    
            </result>   
         </queryResponse>  
      </soapenv:Body> 
   </soapenv:Envelope> 

Sample Request Message-query Call-Partner API

POST https://na1.salesforce.com/services/Soap/u/5.0 HTTP/1.1  
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 
1.1.4322.573)  
Content-Type: text/xml; charset=utf-8  
SOAPAction: ""  
Content-Length: 691  
Expect: 100-continue  
Host: na1.salesforce.com   
 
<?xml version="1.0" encoding="utf-8"?> 
   <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://
www.w3.org/2001/XMLSchema"> 
      <soap:Header> 
         <QueryOptions xmlns="urn:partner.soap.sforce.com"> 
            <batchSize>3</batchSize> 
         </QueryOptions> 
         <SessionHeader xmlns="urn:partner.soap.sforce.com"> 
            <sessionId>4I1yNabX_5FyOGOnuFO64VpRP0791eQNkq3V_jXlNKOSU</sessionId> 
         </SessionHeader> 
      </soap:Header> 
      <soap:Body> 
         <query xmlns="urn:partner.soap.sforce.com"> 
            <queryString>select id, Website, Name from Account where Name = 'Golden 
Straw'</queryString> 
         </query> 
      </soap:Body> 
   </soap:Envelope> 

Sample Response Message-query Call-Partner API

HTTP/1.1 200 OK  
Server: sfdc  
Content-Type: text/xml; charset=utf-8  
Transfer-Encoding: chunked  
Date: Wed, 07 Jul 2004 16:42:42 GMT   
 
<?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:Body>   
         <queryResponse xmlns="urn:partner.soap.sforce.com">    
            <result>     
               <done>false</done>     
               <queryLocator>01g30000000590GAAQ-3</queryLocator>     
               <records xsi:type="sf:sObject" 
xmlns:sf="urn:sobject.partner.soap.sforce.com">      
                  <sf:type>Account</sf:type>      
                  <sf:Id>001300000019kt7AAA</sf:Id>      
                  <sf:Id>001300000019kt7AAA</sf:Id>      
                  <sf:Website>www.oz.com</sf:Website>      
                  <sf:Name>Golden Straw</sf:Name>     
               </records>     
               <records xsi:type="sf:sObject" 
xmlns:sf="urn:sobject.partner.soap.sforce.com">      
                  <sf:type>Account</sf:type>      
                  <sf:Id>00130000001rw25AAA</sf:Id>      
                  <sf:Id>00130000001rw25AAA</sf:Id>      
                  <sf:Website>www.oz.com</sf:Website>      
                  <sf:Name>Golden Straw</sf:Name>     
               </records>     
               <records xsi:type="sf:sObject" 
xmlns:sf="urn:sobject.partner.soap.sforce.com">      
                  <sf:type>Account</sf:type>      
                  <sf:Id>00130000001rwnbAAA</sf:Id>      
                  <sf:Id>00130000001rwnbAAA</sf:Id>      
                  <sf:Website>www.oz.com</sf:Website>      
                  <sf:Name>Golden Straw</sf:Name>     
               </records>     
               <size>19</size>    
            </result>   
         </queryResponse>  
      </soapenv:Body> 
   </soapenv:Envelope> 

 
straussstrauss
Thank you.  The reason is that the abstraction layer gets in the way if you want to stuff all the data into another framework that expects XML - like Spry.
Abhinav KantAbhinav Kant
hi  is there a possiblity to haave multiple query tag to execute multiple queries?