1

I am trying to upgrade a Legacy project's SOAP API from 12.0 to 40.0. The project is using methods from SforceServiceStub.java to perform operations on SalesForce(enterprise wsdl). So to upgrade the api, i have compared the project enterprise wsdl(12.0) with the generated enterprise wsdl(40.0), taken changes and have generated the new enterprise wsdl jar.

Now i am getting errors with the method parameters in the project with the new enterprise wsdl jar(40.0).

I have observed that the method signatures are changed a bit.Extra parameters are present in the latest version. Please have a look at query method from SforceServiceStub in 12.0 and 40.0.

old(12.0):

public com.sforce.soap.enterprise.QueryResult query(
  java.lang.String, 
  com.sforce.soap.enterprise.SessionHeader,
  com.sforce.soap.enterprise.QueryOptions, 
  com.sforce.soap.enterprise.MruHeader);

new(40.0):

public com.sforce.soap.enterprise.QueryResult query(
  java.lang.String, 
  com.sforce.soap.enterprise.SessionHeader, 
  com.sforce.soap.enterprise.QueryOptions, 
  com.sforce.soap.enterprise.MruHeader, 
  com.sforce.soap.enterprise.PackageVersionHeader);

The project is working fine with the changes of 40.0(new signature). But there are lot of changes that needs to be made in the project.

So, i would like to know whether there is any other way with minimal code changes for upgrading enterprise SOAP api from 12.0 to 40.0?

Thanks in Advance

1

The PackageVersionHeader is optional, so you can safely omit it if you aren't using any managed packages or are happy to the the API versions specified when you exported the Enterprise WSDL.

If possible, look to encapsulate all the Salesforce API calls in a single module. Then use that as a single point of interaction between Salesforce and the rest of your code base. I.e. All calls the the query web method will pass through a single method.

That will make it easier to adapt to any future API changes, add error handling, logging, etc...

Depending on how the WSDL is imported into Java you may also be able to create your own override method with the same signature as the older API version and pass through a null PackageVersionHeader.

  • Thanks @daniel-ballinger . It really helps. But do i need to really get and replace new generated wsdl for upgrade with latest API or is it the only process ? – praveen kumar Mar 2 '18 at 13:46
  • Only API versions up to v6 are being retired in the near future. However, if you want to change the API version you need to use the corresponding WSDL that includes the expected method calls, parameters, and responses. – Daniel Ballinger Mar 3 '18 at 9:15

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.