Sunday, November 26, 2017

Generating Java Class files from salesforce wsdl using Apache Axis and sforce.ws.tools and command prompt - salesforce/ webserevice login url


Hi,

I am mentioning the source code to generate the .class files from wsdl using Apache Axis jar files.
I am using the salesforce wsdl file. Creating the class files procedure will not change for other wsdl files when using apache axis.

There are two ways to generate the .class files one is using apache axis and other is using the sforce.ws.tools.


I . Generate java .class files using apache axis.

  • Jar files required 
    • axis.jar;
    • axis-ant.jar;
    • commons-discovery-0.2.jar;
    • commons-logging-1.0.4.jar;
    • dsn.jar;
    • imap.jar;
    • jaxrpc.jar;
    • log4j-1.2.8.jar;
    • mailapi.jar;
    • pop3.jar;
    • saaj.jar;
    • smtp.jar;
    • wsdl4j-1.5.1.jar
You can use the latest mentioned .jar files as per the latest versions available.

2. Save all the jar files in the folder location where you want to generate the .class files and set the classpath of the jar files in the environment variables.

3. Save the wsdl file from salesforce API ( you can select partner/enterprise based on requirement).

4.  open the cmd prompt and change the directory where the .jar files are located.

5. execute the below command

 java -classpath axis.jar;axis-ant.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;dsn.jar;imap.jar;jaxrpc.jar;log4j-1.2.8.jar;mailapi.jar;pop3.jar;saaj.jar;smtp.jar;wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java -a enterprise.wsdl.

Please comment if you are getting any error messages in the procedure.

I have compiled this using java 1.8 version.

Look up fields in Salesforce Flow Datatable

How to fetch lookup fields on flow datatable in Salesforce Flows. Think before you get the solution, this is what one of my colleague(Hans) ...