X

Angelo Santagata's Blog

How to restrict data coming back from a SOAP Call

Angelo Santagata
Architect

In sales cloud a big positive of the SOAP interface is that
lots of related data is returned by issuing a single query, including
master-detail data (ie multiple email addresses in contacts) however these
payloads can be very very large, e.g. In my system querying single
person you get 305 Lines(!), whereas I only want the firstName,LastName and partyId
which is 3 lines per record..

Solution

For each findCriteria element you can add multiple
<findAttribute> element indicating what elements you want to return. By
default if you provide <findAttribute> entries then only those attributes
are returned, and this functionality can be reversed by setting the
<excludeAttributes> to true.


Example 1 :  only retrieving PersonLastName,PersonFirstName,PartyId

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/applicationModule/types/"
xmlns:typ1="http://xmlns.oracle.com/adf/svc/types/">

   <soapenv:Header/>

   <soapenv:Body>

      <typ:findPerson>

        
<typ:findCriteria xsi:type="typ1:FindCriteria" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

           
    <typ1:fetchStart>0</typ1:fetchStart>

           
    <typ1:fetchSize>100</typ1:fetchSize>

<typ1:findAttribute>PersonLastName</typ1:findAttribute>

               
<typ1:findAttribute>PersonFirstName</typ1:findAttribute>

               
<typ1:findAttribute>PartyId</typ1:findAttribute>

           
<typ1:excludeAttribute>false</typ1:excludeAttribute>

    
    </typ:findCriteria>

      </typ:findPerson>

   </soapenv:Body>

</soapenv:Envelope>

Notes

findAttributes work on the level1 attributes of that
findCriteria, the value can be a attribute or an element

If you want to restrict SubElements you can use
childFindCriterias for that subelement and then add findAttributes within
that

Example 2 :  Only Retrieving PartyId, and within
Email element only EmailAddress     

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/applicationModule/types/"
xmlns:typ1="http://xmlns.oracle.com/adf/svc/types/">

   <soapenv:Header/>

   <soapenv:Body>

      <typ:findPerson>

        
<typ:findControl>

           
<typ1:retrieveAllTranslations/>

        
</typ:findControl>

        
<typ:findCriteria xsi:type="typ1:FindCriteria" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

       
    <typ1:fetchStart>0</typ1:fetchStart>

           
<typ1:fetchSize>100</typ1:fetchSize>

<typ1:findAttribute>PartyId</typ1:findAttribute>

           
<typ1:findAttribute>Email</typ1:findAttribute>

           
<typ1:excludeAttribute>false</typ1:excludeAttribute>

<typ1:childFindCriteria>

              
<typ1:fetchStart>0</typ1:fetchStart>

              
<typ1:fetchSize>10</typ1:fetchSize>

<typ1:findAttribute>EmailAddress</typ1:findAttribute>

              
<typ1:excludeAttribute>false</typ1:excludeAttribute>

              
<typ1:childAttrName>Email</typ1:childAttrName>

</typ1:childFindCriteria>

        
</typ:findCriteria>

      </typ:findPerson>

   </soapenv:Body>

</soapenv:Envelope>

Notes

For a childFindCriteria to work you must query it in the
parent, which is why “Email” is referenced in a findAttribute on line 14

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.