Java java.lang.ClassCastException with selectCmDevice

Version 1
    This document was generated from CDN thread

    Created by: john katsavras on 31-05-2013 05:23:33 AM
    Hi there,
    Just wondering if anyone can see why i am getting the exception "java.lang.ClassCastException" from the code below:          
            // Instantiate the wsimport generated SXML API Service client --
            RISService risportService = new RISService();
            RisPortType risportPort = risportService.getRisPort();
            // Set the URL, user, and password on the JAX-WS client
            String hostUrl = "";
            ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, hostUrl);
            ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, cucmDetails.getAxlUsername());
            ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, cucmDetails.getAxlPassword());
            // create and populate the selectCmDevice request
            SelectCmDevice sxmlParams = new SelectCmDevice();
            CmSelectionCriteria criteria = new CmSelectionCriteria();
            long maxNum = 200;
            long modelNum = 255;
            ArrayOfSelectItem items = new ArrayOfSelectItem();
            //create a select item criteria to retrieve devices with names matching "SEP123412341234"
            SelectItem item = new SelectItem();
            //Search on all nodes
            //get back max 200 phones. 9+ can get upto 1000
            //get back phones only
            //255 means get back ALL phone models
            //get back only Registered phones
            //return results in order of name
            //array of phones to get results back for
            //make selectCmDevice request
            SelectCmDeviceReturn selectResponse = risportPort.selectCmDevice("",criteria); << This is where i get the exception outline below
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: [C cannot be cast to java.lang.String
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at com.sun.proxy.$Proxy40.selectCmDevice(Unknown Source)
        at utils._9.APIRIS9.getPhoneIPadd(

    Subject: RE: Java java.lang.ClassCastException with selectCmDevice
    Replied by: David Staudt on 31-05-2013 05:57:36 PM
    I'm thinking that perhaps the service URL being specified here should be:
    https://<server name>/realtimeservice/services/RisPort70
    The latter is the URL for the newer version of the service which provides the SelectCmDeviceExt request.
    Probably when the response is returned, the XML does not match up with the schema-generated code from the SelectCmDevice request and there is a cast exception.

    Subject: RE: Java java.lang.ClassCastException with selectCmDevice
    Replied by: john katsavras on 03-06-2013 05:44:35 AM
    Hi David,

    Thanks for the reply. it turns out the issue was with line:
    ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, cucmDetails.getAxlPassword());

    Password are stored as char arrays in java. The solution was:
    ((BindingProvider) risportPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, String.valueOf(cucmDetails.getAxlPassword()));

    works now.