{"id":2615,"date":"2013-09-28T01:57:04","date_gmt":"2013-09-27T20:57:04","guid":{"rendered":"http:\/\/www.chiragmehta.info\/chirag\/?p=2615"},"modified":"2013-09-28T02:11:34","modified_gmt":"2013-09-27T21:11:34","slug":"salesforce-generating-stub-codejar-from-a-wsdl","status":"publish","type":"post","link":"https:\/\/www.chiragmehta.info\/chirag\/2013\/09\/28\/salesforce-generating-stub-codejar-from-a-wsdl\/","title":{"rendered":"Salesforce &#8211; Generating Stub Code(Jar) from a WSDL"},"content":{"rendered":"<p>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.<\/p>\n<p>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.<\/p>\n<p>Below are three easy steps to generate stub code (jar) from a wsdl:<\/p>\n<ol>\n<li>Download Enterprise (Partner) WSDL by navigating to Setup -&gt; API &#8211; &gt; Enterprise (Partner) WSDL (right click and save file as &#8220;abc.wsdl&#8221;, ensure extension &#8220;.wsdl&#8221; is there).<\/li>\n<li>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: <a title=\"http:\/\/code.google.com\/p\/sfdc-wsc\/downloads\/list\" href=\"http:\/\/code.google.com\/p\/sfdc-wsc\/downloads\/list\" target=\"_blank\" rel=\"noopener\">http:\/\/code.google.com\/p\/sfdc-wsc\/downloads\/list<\/a><br \/>\nNow generate Stub Code from a WSDL. Run wsdlc on the WSDL you have downloaded:<\/p>\n<blockquote><p>java -classpath wsc-xx.jar com.sforce.ws.tools.wsdlc *wsdl* *jar.file*<br \/>\nor<br \/>\njava -jar wsc-23.jar *wsdl* *jar.file*<\/p><\/blockquote>\n<p>wsdl is the name of the WSDL file<br \/>\njar.file is the name of the output jar file that wsdlc generates<br \/>\nYou can include an optional argument: -Dpackage-prefix=myprefix<\/li>\n<li>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.<\/li>\n<\/ol>\n<p>With this you are all set with stub code \/ library and ready to make soap API calls to Salesforce.<\/p>\n<p>Enjoy Coding!<\/p>\n<p>References:<br \/>\n[1]\u00a0<a title=\"https:\/\/code.google.com\/p\/sfdc-wsc\/\" href=\"https:\/\/code.google.com\/p\/sfdc-wsc\/\" target=\"_blank\" rel=\"noopener\">https:\/\/code.google.com\/p\/sfdc-wsc\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[152,79,155,171,51,156,169,153,154],"class_list":["post-2615","post","type-post","status-publish","format-standard","hentry","category-salesforce","tag-api","tag-cloud","tag-enterprise-wsdl","tag-integration","tag-java","tag-partner-wsdl","tag-salesforce","tag-wsc","tag-wsdl","post-preview"],"_links":{"self":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/comments?post=2615"}],"version-history":[{"count":6,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2615\/revisions"}],"predecessor-version":[{"id":2617,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2615\/revisions\/2617"}],"wp:attachment":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/media?parent=2615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/categories?post=2615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/tags?post=2615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}