migrating from SOAP to REST based web service

User 23ba1704ca

13-11-2013 22:35:38

Hello team


We were using SOAP based web service for structure search and now we are migrating
to Rest API.


 


Rest API is successfully deployed and connected to MySQL
database. While performing a structure search using REST api on same table which was working with Ajax2 api it give an error
message as below:


{"errorCode":0,"errorMessage":"java.lang.String
cannot be cast to [B\nCaused by:\njava.lang.String cannot be cast to
[B","rootCause":"java.lang.ClassCastException","rootErrorMessage":"java.lang.String
cannot be cast to [B"}


 The issue is:


If the query is passed with no parameter values to REST API, it returns no error, but returns zero records. However, when the SMILE string is passed as a parameter, the above error message appears.


Can we use same data table of Mysql with REST api, which was being used with ajax2 for
structure search or any change is required in it?


 Also, please find attached the table schema that we are using.

ChemAxon e07e2a364b

14-11-2013 07:44:13

If you upgrade the jchem version, you must regenerate the tables. There were table format changes between version 6.1.1 and 6.1.2. You can regenerate the tables by the appropriate version of jchem manager or sending the regenerate post request. Please, be aware that in case of using regeneration through web services, you must restart tomcat, before and after the regeneration.


 


Gabor

User 23ba1704ca

14-11-2013 08:51:33

Hello Gabor


 


Thanks for the response.


Also, i wanted some more information from you. If you look at the screen shot - mysql_single_record_snapshot.png, there is a data column in the table cd_taut_frag_hash. This contains a blank value. Can it be possible that this NULL value for this data column is creating problems?


 


Thanks


Ashish

ChemAxon d4fff15f08

19-11-2013 11:22:37

Hi Ashish,


 


The errors come because your DB contains obsolete data. To fix this, you just have to upgrade or regenerate your table using the same version JChem Manager as your search engine is. The upgrade could be done using GUI, or command line requests.


if you initiate the upgrade from command line, please use:


'jcman u' command for upgrade (this will upgrade the DB e.g.: adding new columns, change the structure of the table). Please note that using this command will upgrade all the tables present in the given schema(DB).


in case the recalculation of the fields is not done because any reason during upgrade you may initiate it using 'jcman r' command.


More information about Jchem Manager and its functionality could be found here: https://www.chemaxon.com/jchem/doc/admin/


 


Best regards,


Norbert

User 23ba1704ca

20-11-2013 15:33:14

Hello Nobert, thanks.


 


This worked!!


Ashish

User 23ba1704ca

20-11-2013 15:38:07

Hello


There is another problem that we are now facing with REST API. 


 


We are using REST API in our code with PHP & MySQL at the backend. We added an additional custom field 'master_cas_no' in the jchem table using Jchem manager.
Type of field is INT.


While adding a new structure in database, below POST request
is used:


/webservices/rest-v0/data/<DB Name>/table/<Table
Name>/operation


{


 
             
"operationType": "INSERT",


                "structure": "CCCCC",


                "master_cas_no": "8"


 }


 


It successfully inserts the structure in data table, but no value is being inserted in
custom field (master_cas_no).


This request is kind of urgent as there are deliverables that are associated with this problem that we are facing.


 


Thanks


Ashish

ChemAxon 13811e1703

21-11-2013 08:37:03

Hi!


 The request should look like this:


{


     "operationType": "INSERT",


     "structure": "CCCCC",


     "additionalData":{


         "master_cas_no": 8


     }


 } 

When you are doing database modifications with JChem manager or any other external tool, the changes won't be reflected immediately on the REST api, server restart is recommended for this use case.

Regards,
Peter 

User 23ba1704ca

21-11-2013 08:40:58

Thanks Peter


 Will try this out and let you know the outcome.


 


Regards


Ashish

User 23ba1704ca

28-11-2013 04:47:55

Hello Peter


 


The solution worked out well.


 


Thanks


Ashish

User 23ba1704ca

28-11-2013 04:50:13

Hello Team


 


We have integrated REST API (jchem Version: 6.1.3_b656) on
windows environment with our custom code and its working well.


 Same is migrated to Linux server and following steps were followed:


 


1. Deployed web service on server


2. Migrated code to server


3. Export of MySQL db to Linux server


 


Post migration on Linux server web service is working
correctly with sample DB but when connected with imported database it gives the error mentioned below:


{"errorCode":0,"errorMessage":"<database_name_here>
is not
initialized!","rootCause":"java.lang.IllegalStateException"}


 


 


jchemproperties, jchemmetadata and other required tables do
exists in this database. The same structure is working well on windows environment but not on Linux. Your help is appreciated here.


 


Thanks


Ashish Dugar

ChemAxon e07e2a364b

29-11-2013 14:25:54

If it works well on windows, then your problem is most probably case differencies in the names. Please, be aware the db/table names are case sensitive in mysql for linux. You can query the jchemproperty table to see which forms the jchem reference to the table names.

User 03592810fa

29-11-2013 20:25:11

Thanks, we have verified tables names in db. Actually this error comes with 'List tables'


/webservices/rest-v0/data/<database name here>/table


 


response:


{"errorCode":0,"errorMessage":"<database name here> is not initialized!","rootCause":"java.lang.IllegalStateException"}


 


Any views?

ChemAxon e07e2a364b

30-11-2013 08:36:04

Database not initialized means that the jchem base cannot find the JChemProperties table, does this table name match with the name in your config file?

26-03-2014 03:08:10

Queries in the database seems complicated, I still dont know how to match this up Jchem

ChemAxon 13811e1703

09-04-2014 10:22:03

Match up JChem versions? The database under JChem Web Services should be the same version as the WS itself.

Peter 

User 23ba1704ca

10-04-2014 05:37:15

Hello Peter


 


Yes, that was the problem and we have already addressed it.


 


Thanks


Ashish

User a8605aa1dc

29-04-2014 16:53:34

Hi Ashish,


                I am using SOAP web services right now and my boss needs me to migrate it to REST web services. Please let me know what steps/cases i need to consider in migrating from soap to restful web services.

ChemAxon 13811e1703

07-05-2014 09:01:59

Hi Pavangb,

Can you collect your current usecases with the SOAP services? We can provide detailed information on migration issues if you let us know.

Contact us any time you need help on migration!

Regards,
Peter