function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Harish NarayananHarish Narayanan 

Importing partner.wsdl using WSC

Hello,

I am trying to import the partner.wsdl in my java environment. I am using Mac OS X 10.10 and JDK 1.7 u60. I downloaded the WSC jar file from http://mvnrepository.com/artifact/com.force.api/force-wsc/33.0.3 and using it to import the wsdl file. The jar file, wsdl file are in the current directory.
When I execute the following command, I get a bunch of error messages.

java -classpath force-wsc-33.0.1.jar com.sforce.ws.tools.wsdlc partner.wsdl partner.jar

Exception in thread "main" java.lang.NoClassDefFoundError: org/stringtemplate/v4/STGroupDir
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
    at java.lang.Class.getMethod0(Class.java:2813)
    at java.lang.Class.getMethod(Class.java:1663)
    at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.stringtemplate.v4.STGroupDir
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 6 more

When I googled, they point to issues in classpath, but I have referenced to the right classpath in my environment variable. 

<~/Downloads>echo ${CLASSPATH}

:/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home:/Users/harish/Downloads:/Users/harish/Coding/JM


Could someone help me with this situation? Thanks.

-Harish
Cyrus TalladenCyrus Talladen
I used this link to download the wsc tool

https://code.google.com/p/sfdc-wsc/downloads/list

and followed jeff douglas' tutorial 

http://blog.jeffdouglas.com/2010/05/17/java-command-line-app-using-the-salesforce-wsc/

and assuming your java command line is working properly then the line: 

java -cp ....   

should work since that's how I did it for a task I had.

Cyrus T
www.levementum.com
 
Harish NarayananHarish Narayanan
Thanks Cyrus. The google code link contains older version of wsc.jar. Though, I downloaded them and it worked, and now am able to generate the jar from the wsdl.

Does this mean the wsc jar file from http://mvnrepository.com/artifact/com.force.api/force-wsc/33.0.3 has some issue in executing? Which is the primary source of the wsc and is it okay to use older wsc.jar files for wsdl files belonging to latest api version (33.0)?
Cyrus TalladenCyrus Talladen
You can try adding force-wsc as a dependency for your project in your IDE.  Both methods worked for me, and the basic SOAP functionality was there in both versions that I have tested.  I was able to send and receive decent-sized payloads through SOAP using the older versions as well. It may have been possible that force-wsc does not support some versions of java.