Post

2 followers Follow
0
Avatar

Issues after V6 Upgrade

Ever since our upgrade we have not been able to connect to Clarizen using the API.

I was informed that we would need to make some changes to the initial API code as shown below.

ClarizenStub clz=new ClarizenStub();

org.apache.axis2.client.Options options =  clz._getServiceClient().getOptions();

 // Time out after a minute

 options.setTimeOutInMilliSeconds(60000);

/Compress responses

options.setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true);

LoginOptions loginOptions = new  LoginOptions();

 //Change to a name describing your application

 // loginOptions.setApplicationId("Java test client");

 //Contact the login server to get the URL of your datacenter

  GetServerDefinitionResult srvDef = clz.getServerDefinition("username","password", null,null);

  //Change the SOAP client endpoint to use the new URL

clz._getServiceClient().getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(srvDef.getServerLocation()));

  //Call the Login method

LoginResult loginResult =  clz.login("username", "password", null);

  //Create a header that will hold the Session ID returned fron the login operation

SessionHeader sessionHeader=new SessionHeader();

  sessionHeader.setID(loginResult.getSessionId());

Session session = new Session();

session.setSession(sessionHeader);

 

Making the above changes resulted in several method undefined errors.  I then found out that we needed to download new classes.  I was given the following link to get the compiled classes I would need.  

https://dl.dropboxusercontent.com/u/17082623/clarizen-java/JavaAxis2Client/classes.zip

 

I downloaded the classes and replaced the existing classes with the newly downloaded classes.  After cleaning and re-building my project. I was still receiving the same error messages as before.  I tried again to import the new classes into eclipse overwriting the old files.  I then cleaned and re-build my project again.  Now the project can't find the ClarizenStub class.

I have verified that all the classes are in the same location as before, and the classes that cannot be found within the project are there in the com directory.

It seems as though there is another piece of the setup that I'm missing.  Does anyone know of anything else that needs to be done to get this to work with the upgrade?

We are using Java and eclipse to create our project.  

 

-Mac

Mac Abhay Answered

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Mac.

Seems like you're having trouble re-generating the Java classes. I've seen several Java and SOAP tools and each has a different procedure to do that. Try mine and hopefully it'll work.

I recently successfully generated the Java classes for the API. I'm using:

Eclipse Java EE IDE for Web Developers.

Version: Kepler Service Release 1

To generate the classes I installed the Axis 2 code generator from:  http://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.html

Then:

  1. Right click the 'src' folder of your project and choose New -> Other -> Axis2 Wizards -> Axis2 Code generator
  2. Generate Java code from WSDL file
  3. WSDL File Location: https://api2.clarizen.com/v1.0/clarizen.svc
  4. codegen options: Custom.
  5. Advanced Options -> Switch on Unwrapping   -> OK   -> next
  6. On Output: choose 'Browse and select a project under the current Eclipse workspace'
  7. Click 'Browse' and select the root of your project
  8. Check 'Add Axis2 libraries...' and select axis2 home (click 'check libs' to verify)
  9. Finish
  10. After classes were generated, 'Configure Build Path' for the project  -> Add External JARs  and choose all JARs on the AXIS2\Lib folder .

That did it for me. 

Hope this helps

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Hi Ophir Kenig,

 

I have followed exactly your guide, and even gave up on Eclipse Luna and reinstall Eclipse Kepler SR2. But, only successfully generated all the .java files, not the .class files ...

Did I miss any steps still?

 

Thanks in advance.

 

Regards,

kamyen

 

ClarizenAdmin 0 votes
Comment actions Permalink
0
Avatar

Hi Kamyen,

I'm not an expert in Java/Eclipse, so I have little idea what could have gone wrong.

However, the post you've followed is a year and a half old and we've introduced new API options since then:

  1. Clarizen SOAP API V2.0. Check this URL to get started:
    https://success.clarizen.com/entries/90254587-Clarizen-Web-Services-API-Guide-V2-0
    This guide also contains some instructions for Java/Eclipse developers.
  2. Clarizen REST API V2.0 (including support for CZQL query language). Though it's a different type of API you may find it as useful. It should also be easier to setup. Check this URL to get started:
    https://success.clarizen.com/entries/89516637-Clarizen-REST-API-Version-2-0

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink