0

We are having java application which consumes salesforce partner.wsdl. We login to salesforce instance, then we get metadata for all the objects and we cache it. As salesforce objects become more we are seeing more time in getting metadata and cache it for first call.

  1. What is the best way we can reduce this time, even if more objects are introduced in salesforce?

  2. Is there any soap api call I can make to get metadata only for the object and its dependencies?

  3. do we need to use only describeSobject to get these information.?

veerabhadra
  • 21
  • 1
  • 5

1 Answers1

0

Cache the SF responses, flush the cache once a day, not with every request?

Look into REST API, either as complete replacement or just to take advantage of the "if-modified-since". This header works also per object.

Experiment with queries on EntityDefinition table to learn names of only the objects you're interested with (you probably don't care about apex classes, custom settings, *share and *history tables..). For example https://stackoverflow.com/a/64276053/313628

Then yes - describe just them, using REST or SOAP's describeSobject. If you have many objects - the network roundtrips might be an issue, you'd need to debug the app to see where it spends most time. Combat it by requesting up to 100 objects at a time, maybe issuing multiple requests (async processing? threads?) and combining results later.

Does it have to be partner WSDL? You could "preload" objects in your app using enterprise wsdl and combine some techniques listed above.

eyescream
  • 18,088
  • 2
  • 34
  • 46
  • Thanks for the reply. We are using partner.wsdl. One of the salesforce instance has around 4025 objects. And in each describeSobject request we are sending 100 objects and it almost take more than 3mins to complete getting all metadata. I checked network latency I don't see much difference between each describeSobject call. Can't we do like get only the metadata for an object and its dependencies? For ex: say account depends on some 5 objects(object1, object2, object3, object4, object5)? Or again we need to get metadata for object1 dependency as well? – veerabhadra May 11 '21 at 05:55
  • Well, what are you doing with the info. Backups? You need to insert accounts and the lookups (foreign keys) are mandatory? There's no nice way to describe object and all lookups, all child relationships in 1 go. Field might be marked as mandatory or it might be checked with "validation rules" (conditional logic, bit like constraints in normal database). Check the headers route (even if you'll fall back to SOAP because you need actual xml format back). Check how many of these objects are actually useful, run that query on EntityDefinition I linked to with and without WHERE clause. – eyescream May 11 '21 at 06:04
  • no backups. We have set of operational activities implemented consuming partner.wsdl like (CRUD, polling). So before performing any of the operation like create a record in contact, we will get metadata for all the objects. Till now we saw around 1000 objects so it was not taking much time. But after it goes to 4000+ the initial run takes more time, as it has to get metadata for all and then cache. From second run it looks fine. So the thought was is there anyway to get only the required metadata (in the above example contact object), than getting everything at once. – veerabhadra May 11 '21 at 07:24