1

For an example I have a webservice class as shown below .This should be exposed to one of the portal.

This portal is having a callbackurl to configure.That means this portal is going to hit my application .

My question is how to create url for this class and do i need to give them Partner WSDL file or the webservice class wsdl file.so that they can hit my class.

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;
  }
}

2 Answers 2

3

You can generate a WSDL specific for calling you Apex web service.

Go to: Setup > App Setup > Develop > Apex Classes.

Find your class. There will be a WSDL link next to the Edit and Del links, or a Generate WSDL button with viewing the Apex Class.

This WSDL will include the required URL.

Note that to call the web service you will need to specify the SessionId in the SessionHeader.

2
  • global class getpathInfo { WebService static Related_Record__c getpathInfoByContact(string Path,String ConID) { Related_Record__c R = new Related_Record__c(); R.Contact__c = ConID; R.Path__c = Path; insert R; return R; } } This is my class and I have also generated wsdl file for it .How to specify session id and session header. Mar 24, 2015 at 9:30
  • @SalesforceLearner You should ask about the session ID etc. as a new question if you can't find the information. They'll need to use the standard login end point to authenticate and get a session ID.
    – Matt Lacey
    Mar 25, 2015 at 1:43
0

You will first need to generate WSDL using

Setup > App Setup > Develop > Apex Classes

There will be a WSDL link use that and generate WSDL.

You will need to share your enterprise WSDL as well as that will have login() call implemented to fetch session Id using password and Username .

You must log in to answer this question.

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