How to restrict data coming back from a SOAP Call

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

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Architect & Technology Evangelist - If its middleware,PaaS/SaaS integration then I'm interested

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« September 2015
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today