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
ckempckemp 

Java API using old API version

I have set up the Java Partner API on our platform (Java/Spring/Hibernate) and am able to log in and do queries.  However, when I use this, it appears to be using an old version of the API.  For instance, I cannot access Event.StartDateTime or Event.StartEndTime which have been available at least since version 12.0, nor can I access Event.Type. 

 

How do I access these fields?  Is it possible to use the new Partner API somehow or do I have to manually do Web Services through something else other than the given com.sforce.soap.partner packages? (e.g. create my own XFire code)

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

the sample is just that, a sample, its not meant to be the process by which you get access to the API. 

 

the APi docs walk through the process of generating the api stubs from the WSDL document using WSDL2Java etc. 

All Answers

SuperfellSuperfell
download an upto date partner WSDL from the app and re-import it.
ckempckemp

How do I do this?  I've downloaded the latest Partner WSDL but haven't a clue what to do with it and can't find instructions on how to do so.

 

Thanks for your help, Simon.

SuperfellSuperfell
do whatever you did with it the first time around. (or go read the getting started section of the API docs)
ckempckemp

The first time around, I downloaded the Java Partner WSDL Sample 10.0 from here, added the included library JARs to my app, and added the com.sforce.soap.partner.* package source files included.  Works great, albeit with API v10.0.

 

When I download the new Partner WSDL as you indicated, I get an XML document defining the Partner WSDL.  I don't understand how these two things are related. What should I be doing?

SuperfellSuperfell

the sample is just that, a sample, its not meant to be the process by which you get access to the API. 

 

the APi docs walk through the process of generating the api stubs from the WSDL document using WSDL2Java etc. 

This was selected as the best answer
ckempckemp
Ahhh... That's a good reason why the sample uses the old API. :-)  Will try following the directions here and hopefully that will get me back in business.
ckempckemp
Got it working.  It's easy if you know what you're doing (which I clearly didn't):

  1. Download the Apache Axis binaries (axis-bin-1_x.tar.gz) and uncompress.
  2. Download the Partner WSDL from your Salesforce instance from Setup > Develop > API and saving the "Download Partner WSDL" link as partner.wsdl to the same directory you saved the compressed file in step 1.
  3. Go in to the axis-1_x (the one that was created in step 1 when you uncompressed it.)
  4. Run this command on the command line: "java -classpath lib/axis-ant.jar:lib/axis.jar:lib/commons-discovery-0.2.jar:lib/commons-logging-1.0.4.jar:lib/jaxrpc.jar:lib/log4j-1.2.8.jar:lib/saaj.jar:lib/wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java -a ../partner.wsdl".

And... voila!  You should see a new com directory where you have the generated com.sforce.soap.partner classes.  These instructions would have saved me an entire morning, so hopefully they can help others.

However, I'm still unable to get Event.type.  I'm still getting "No such column 'Type' on entity 'Event'."  Any ideas?
SuperfellSuperfell

Did you not see this in the docs? or it is missing a step ?

 

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_quickstart_steps.htm#step_3_import_the_wsdl_file_into_your_development_platform 

ckempckemp

I definitely missed that.  It was not in the instructions that I was looking at, that's for sure!

 

Any ideas why I'm not able to query on Event.type with this newly generated code?  This should be in the new WSDL and the API indicates that I should be able to.

SuperfellSuperfell
Have you checked if its been hidden via Field level security?
ckempckemp
Ahhhh!  Yes it is set to "hidden".  Presumably this is the default?  I don't want to have to ask all of our clients to have to manually turn this on, so I'm guessing I can't access this field.  Right?
SuperfellSuperfell
I believe it defaults to hidden for many of the templates used during signup. It would need changing from hidden for you to be able to access it. however you can use the describeSObject("Event") api call to determine if this field is available at runtime, and change your query/logic appropriately.
ckempckemp
Darn.  I was hoping it was on by default.  Thanks again for all your help SimonF!