[RESOLVIDO] Erro ao retornar um array de String

Pessoal… bom dia!

Tenho o seguinte código:

public SimpleCancellableTask getTask() {
if (task == null) {
// write pre-init user code here
task = new SimpleCancellableTask();
task.setExecutable(new org.netbeans.microedition.util.Executable() {
public void execute() throws Exception {
// write task-execution user code here
[b]Service1_Stub ss = new Service1_Stub();
String res[] = ss.selecionarTeste();

                for (int i=1; i<=res.length; i++)
                {
                    txt_chamados.insert(res[i], 0);
                }[/b]                
            }
        });
        // write post-init user code here
    }
    return task;
}

Comecei a Debugar, e quando o break point está nessa linha: String res[] = ss.selecionarTeste();,
ele vai para o seguinte código (o código está na Stub Service1_Stub.java):

public String[] selecionarTeste() throws java.rmi.RemoteException {
Object inputObject[] = new Object[] {
};

    Operation op = Operation.newInstance( _qname_operation_SelecionarTeste, _type_SelecionarTeste, _type_SelecionarTesteResponse );
    _prepOperation( op );
    op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/SelecionarTeste" );
    Object resultObj;
    try {
        resultObj = op.invoke( inputObject );
    } catch( JAXRPCException e ) {
        Throwable cause = e.getLinkedCause();
        if( cause instanceof java.rmi.RemoteException ) {
            throw (java.rmi.RemoteException) cause;
        }
        throw e;
    }

    String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
    [color=red][b]System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);[/b][/color]        
    return _res;
}

Analisando o Debug, a variável resultObj retorna todos os valores que eu preciso, mas o erro acontece na linha em vermelho.

Alguem tem alguma idéia do que pode ser?

Por Favor poste em Code.

[code]public SimpleCancellableTask getTask() {
if (task == null) {
// write pre-init user code here
task = new SimpleCancellableTask();
task.setExecutable(new org.netbeans.microedition.util.Executable() {
public void execute() throws Exception {
// write task-execution user code here
Service1_Stub ss = new Service1_Stub();
String res[] = ss.selecionarTeste();

for (int i=1; i<=res.length; i++)
{
txt_chamados.insert(res[i], 0);
}
}
});
// write post-init user code here
}
return task;
} [/code]


[code]
public String[] selecionarTeste() throws java.rmi.RemoteException {
Object inputObject[] = new Object[] {
};

Operation op = Operation.newInstance( _qname_operation_SelecionarTeste, _type_SelecionarTeste, _type_SelecionarTesteResponse );
_prepOperation( op );
op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/SelecionarTeste" );
Object resultObj;
try {
resultObj = op.invoke( inputObject );
} catch( JAXRPCException e ) {
Throwable cause = e.getLinkedCause();
if( cause instanceof java.rmi.RemoteException ) {
throw (java.rmi.RemoteException) cause;
}
throw e;
}

String[] _res = new String[((Object [])((Object []) resultObj)[0]).length];
System.arraycopy(((Object []) resultObj)[0], 0, _res, 0, _res.length);
return _res;
}[/code]

Verifique se o que você esta é OBJETOS, e está tentando colocar em um Array de qual tipo

;D

Então cara… não consegui entender muito bem o que vc quis me dizer!

Poderia explicar novamente?

Acho que compreendi a sua resposta…

selecionarTeste é um método que me retornar um String[] e implico o valor na variável do mesmo tipo.

A grande dificuldade continua sendo no ArrayCopy que por algum motivo não deixa copiar os valores de um array para o outro.

Tá osso descobrir isso!

Bom cara… consegui fazer o esquema do array String trabalhando com ksoap2.
Antes eu estava usando o stub gerado pelo cliente WebService.

Mas agora as coisas estão indo bem!

Obrigado pela ajuda ai e pela dica do Code!
Hehehehe