0

I have a web service class and I need to generate WSDL . When I click button it is generating wrong WSDL.

I don't see any of the fields related to my web service in the generated WSDL file.

Generated WSDL, it has city, country etc. But none of these field are in my web service class

global class A {
    webservice string accountId;               
    webservice string customerNumber;          
    webservice string sysProfileId;            
    webservice string sysProfileName;           
    webservice boolean inactive;                

    webservice list<WS_Machine> machines;

    global class WS_Machine {
        webservice string machineId;               
        webservice string machineName;             
        webservice string osName;                  
        webservice string osVersion;                

        webservice string name;                    
        webservice string Id;                       
        webservice string productName;              
        webservice string version;                  
        webservice string extension;                    
        webservice string webServer;                
        webservice string servletEngine;          
        webservice string mobileDeviceModel;        
    }
}
1
  • Is there a corresponding method marked with webservice that accepts class A as a parameter or returns it as a result? Commented Nov 3, 2015 at 19:50

1 Answer 1

2

If you have created global classes that are part of the signature of your webservice method those fields also need to be marked with webservice.

This is illustrated in the "Define Web Service Member Variables or Classes" section of he Apex Web Services and Callouts documentation:

global class AccountPlan {

   webservice String area; 
   webservice String region; 

   //Define an object in apex that is exposed in apex web service
   global class Plan {
      webservice String name;
      webservice Integer planNumber;
      webservice Date planningPeriod;
      webservice Id planId;
   }

   webservice static Plan createAccountPlan(Plan vPlan) {

       //A plan maps to the Account object in salesforce.com. 
       //So need to map the Plan class object to Account standard object
       Account acct = new Account();
       acct.Name = vPlan.name;
       acct.AccountNumber = String.valueOf(vPlan.planNumber);
       insert acct;

       vPlan.planId=acct.Id;
       return vPlan;
  }
}

Also see Considerations for Using the WebService Keyword.

PS

Now you have posted the Apex class I note that you have defined no methods so there will be no operations in the WSDL. It would not surprise me if the WSDL tooling only generates types that are used in operations.

1
  • this results in wrong wsdl : Commented Nov 2, 2015 at 22:51

You must log in to answer this question.

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