1

I am new for integration part. I have created custom WSDL for custom object. when I generate the custom WSDL for that class I got all standard object and custom objects. But I need to have custom object WSDL only. Why am getting all objects. Please can any one help me out how can I resolve this issue. Thanks in advance. Below are my classes what do I need to change:

global class kathir_WSDL {
public String vinNo { get; set; }

List<streamingAPI__vehile__c> results;

public List<streamingAPI__vehile__c>getResults() {
return results;
}

WebService static list<streamingAPI__vehile__c>search(string vinnr) {

list<streamingAPI__vehile__c>acc=[Select name, streamingAPI__Model__c,streamingAPI__Body_type__c,streamingAPI__color__c,streamingAPI__price__c from streamingAPI__vehile__c where Name =:vinnr];
system.debug('listof accounts'+acc);
 return acc;


  }
  public void searchrelated() {
  system.debug('listof varible'+vinNo);


 kathir_WSDL.search(vinNo);
results=[Select Name,streamingAPI__Model__c,streamingAPI__Body_type__c,streamingAPI__color__c,streamingAPI__price__c from streamingAPI__vehile__c where Name=:vinNo];

  }
}
0

I can't explain the reasoning, but if a WebService includes an SObject in its signature, all the standard and custom objects in the org get included in the WSDL as you have noticed.

One way to avoid this is to define your own Apex class and return that. This has the benefit of allowing you to have more control of the naming in the interface i.e. it decouples the interface from the underlying SObject. But the cost is that you have to add more code whenever the SObject changes:

global class kathir_WSDL {
    global class Vehicle {
        WebService String name;
        Webservice String model;
        ...
        private Vehicle(streamingAPI__vehile__c v) {
            name = v.name;
            model = v.streamingAPI__Model__c;
            ...
        }
    }
    WebService static List<Vehicle> search(String vinnr) {
        List<Vehicle> vehicles = new List<Vehicle>();
        for (streamingAPI__vehile__c v : [...]) {
            vehicles.add(new Vehicle(v));
        }
        return vehicles;
    }
}

Another way is to manually remove the unwanted object definitions from the WSDL before providing the WSDL to your client.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.