When integrating any non native application (JAVA or NET or ..) with salesforce, you need to have the salesforce API library in place that can be referred/used as a referenced library in project being developed. This library is the the one that acts as face to salesforce i.e., intermediary between your application and salesforce.
Simple yet important step of such type of integration is to generate stub code (jar file) from wsdl (salesforce enterprise or partner wsdl) and though such a simple step, we (at least I) always forget (or I should say cant recall easily) the step on how to generate same.
Below are three easy steps to generate stub code (jar) from a wsdl:
- Download Enterprise (Partner) WSDL by navigating to Setup -> API – > Enterprise (Partner) WSDL (right click and save file as “abc.wsdl”, ensure extension “.wsdl” is there).
- Download Force.com Web Service Connector (WSC) [1]. The Force.com Web Service Connector (WSC) is a high performing web service client stack implemented using a streaming parser. WSC also makes it much easier to use the Force.com API (Web Services/SOAP or Asynchronous/REST API). You can download a pre-built WSC jar file from: http://code.google.com/p/sfdc-wsc/downloads/list
Now generate Stub Code from a WSDL. Run wsdlc on the WSDL you have downloaded:java -classpath wsc-xx.jar com.sforce.ws.tools.wsdlc *wsdl* *jar.file*
or
java -jar wsc-23.jar *wsdl* *jar.file*wsdl is the name of the WSDL file
jar.file is the name of the output jar file that wsdlc generates
You can include an optional argument: -Dpackage-prefix=myprefix - Now write your client application. Add wsc-xx-min.jar and jar.file (generated by wsdlc) to your classpath, then compile and run your client application.
With this you are all set with stub code / library and ready to make soap API calls to Salesforce.
Enjoy Coding!
References:
[1] https://code.google.com/p/sfdc-wsc/
Recent Comments