I have a requirement in which I want to expose a particular set of custom objects to another 3rd party app. But when I generate enterprise wsdl it includes all the objects. But I don't want to give access to other objects. To solve this, I wrote an apex class as shown below

global class PegaToSFDCWebService {

webservice static void updateSFDC(Id opportunityId, PegaEmailResponse__c emails, String pegaOfferResp) {
  Opportunity opp = new Opportunity(Id = opportunityId);
    opp.StageName = 'Closed Won';
    opp.Pega_Offer_Response__c = pegaOfferResp;
    upsert opp;

    insert emails;

Now when I generate wsdl for this class only it also includes several objects which are not used in this class. I just want to give a basic wsdl. Please suggest me good practises to be followed on this. I am doing this for first time.

  • Also tell how salesforce decides what objects be included in wsdl?\
    – doga
    Commented Oct 31, 2013 at 4:33

1 Answer 1


As you have probably worked out, types like DebuggingHeader are generated in the WSDL because they are part of the API infrastructure that is available to a client. While you could (manually) remove them as they are typically optional I am not sure why it would be worth the trouble.

Which of your own SObjects you expose obviously depends which objects you choose to reference in the webservice method signatures. Personally, if there are only a small number of SObjects, I would be tempted to create simple bean classes (classes with just public fields) and use those in the webservice method signatures. This keeps the client interface decoupled from the internal SObjects and so allows either to change independently with the webservice methods acting as adapters between the two.

But if you truly want to create a clean interface, build the API using the @RestResource mechanism where you have control over the URL patterns and so can use a RESTful approach. This is much kinder to your clients, especially if the clients include mobile applications that are built around JavaScript, because the data can be JSON and the operations relatively self explanatory based on the URL patterns. Again you can use bean classes in the interfaces to achieve the decoupling.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .