Wednesday, October 8, 2014

How to contribute to the Salesforce WSDL2Apex project

WSDL2Apex is a Salesforce tool for converting a web services WSDL file into Apex classes that can make the required SOAP callouts and then process the responses. Internally the callouts are made using the Apex class WebServiceInvoke. In September 2014 it was released as an open source project.

I'll cover setting up a development environment to build it and then contribute those changes back in this post. It is loosely based on Peter Knolle's Extending the Force.com IDE article.

  • Clone the project repository from GitHub. The Fork button on the web page made me a clone easily enough at https://github.com/FishOfPrey/WSDL2Apex
  • If you don't have it already, get the Java Development Kit 7. For me this installed as %Program Files%\Java\jdk1.7.0_67.
  • Add the Java 7 JDK bin to the PATH.
    ...\WSDL2Apex\WSDL2Apex-master\target>SET PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.7.0_67\bin
  • Get Apache Maven 3.2.2 to manage the builds and test runs.
  • Setup the Maven PATH requirements as per the Installation instructions.
    > SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_67

    Note the absence of surrounding double quotes. With quotes I was getting the message "Files was unexpected at this time."
    > SET PATH=%PATH%;D:\Development\Maven\apache-maven-3.2.3\bin
  • Package it up, including running the test cases:
    >mvn install package
  • Run WSDL2Apex from the command line:
    ...\WSDL2Apex\WSDL2Apex-master\target>java -jar WSDL2Apex-1.0.jar "C:\PathTo\WSDLs\WithLimitElement.xml" outputDir yes

You will need to submit a Contributor's License Agreement before Salesforce can accept your pull requests. The form is available on the Contributing Code page.

It is licensed under the Eclipse Public License (EPL) v1.0. Eclipse Public License (EPL) Frequently Asked Questions is a useful resource.

See also: