cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

300
Views
0
Helpful
1
Replies
Beginner

Call Studio upgrade from 8.0 to 10 custom elements fail

We upgraded from 8.0 to 10 and our custom java code is now failing across all custom elements (these elements facilitate communication back and forth with a BOS).  We confirmed the version of java is 1.6(24) in the new install and was 1.6(17) in the 8.0 environment.  The other thing that has changed is that in 10, we are running on Windows server 64-bit (8.0 was 32-bit).  We are using the same jar files.  This is working perfectly in the old environment.  See below java and error messages received.  Any ideas/thoughts are very much appreciated!

Jar files (all in the build path and in the same order as in 8.0 environment):

servlet2.3

framework.jar

jsr311-api-0.11

json-simple-1.1

jersey-bundle-1.2

asm-3.1

Custom element java:

import java.net.URI;

import javax.ws.rs.core.MediaType;

import javax.ws.rs.core.UriBuilder;

import org.json.simple.JSONObject;

import org.json.simple.parser.JSONParser;

import com.sun.jersey.api.client.Client;

import com.sun.jersey.api.client.ClientResponse;

import com.sun.jersey.api.client.WebResource;

import com.sun.jersey.api.client.config.ClientConfig;

import com.sun.jersey.api.client.config.DefaultClientConfig;

import com.sun.jersey.api.representation.Form;

/*import java.io.*;

import org.apache.commons.httpclient.*;

import org.apache.commons.httpclient.methods.*;*/

public class Test {

      public static void main(String[] args) {

                  //String json = "{\"status\":203,\"success\":0,\"tokenID\":null,\"message\":\"APP_LOGIN_FAIL\",\"invoice_balance\":0.0,\"account_id\":-1}";

      JSONParser jsonParser = new JSONParser();

      try {

    

          ClientConfig cnfg1 = new DefaultClientConfig();

        Client client = Client.create(cnfg1);

        ClientResponse response_rest;

        WebResource service_rest = client.resource(getBaseURI());

        Form form = new Form();

        form.add("invoice_number","123456");

        form.add("trx_number", "654321");

(err 1) form.add("timestamp", System.currentTimeMillis()/1000L);

(err 2) response_rest = service_rest.path("invoice").path("getInvoice").type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, form);

(err 3) String json = response_rest.getEntity(String.class);

     

        JSONObject jsonObject = (JSONObject) jsonParser.parse(json);

                                String status = ((Long) jsonObject.get("status")).toString();

                                String success = ((Long) jsonObject.get("success")).toString();

                                String tokenID = (String) jsonObject.get("tokenID");

                                String message = (String) jsonObject.get("message");

                                String invoice_balance = ((Double) jsonObject.get("invoice_balance")).toString();

                                String account_id = ((Long) jsonObject.get("account_id")).toString();

                               

                            System.out.println("XML: " + json);

                               

                                System.out.println("Status: "+ status);

                                System.out.println("success: "+ success);

                                System.out.println("tokenID: "+ tokenID);

                                System.out.println("message: "+ message);

                                System.out.println("invoice_balance: "+ invoice_balance);

                                System.out.println("account_id: "+ account_id);

      }

      catch (Exception e) {

                  e.printStackTrace();

      }

                }

               

            private static URI getBaseURI() {

(err 4)    return UriBuilder.fromUri("http://xx.xx.xxx.xx:9080/ivr/api").build();

            }

}   

Error messages:

err 1) The method add(String, String) in the type MultivaluedMapImpl is not applicable for the arguments (String, long)

err 2) The method build(Object[]) in the type UriBuilder is not applicable for the arguments ()

err 3) Type mismatch: cannot convert from Object to ClientResponse

err 4) Type mismatch: cannot convert from Object to String


Thanks again!

Everyone's tags (4)
1 REPLY 1
Highlighted
Enthusiast

Re: Call Studio upgrade from 8.0 to 10 custom elements fail

In 10.0 tomcat version is changed from 6.0 to 7.0 . However , there is no change in java version , so you need to verify if  those cusom jars are compatible with latest TOMCAT version.

please check the compatibility once ?

CreatePlease to create content
Content for Community-Ad
FusionCharts will render here