views:

244

answers:

2

Hi all , I started to use the Netbeans 6.8 web service client wizard . I created a web service (.Net web service) witch return an object Data. The Data class , contains fileds with many types : int , string , double , Person object and array of Person object.

I created the J2ME client code through the wizard and every thing seems ok . I see in the Netbeans project the service and the stub . When I try to call my web service method , say Data GetData() ; Then I have a problem with parsing the returned data from the web service and the client data object . As follows : After finishing to call the web service method , in the stub code : public Data helloWorld() throws java.rmi.RemoteException { Object inputObject[] = new Object[] { };

    Operation op = Operation.newInstance( _qname_operation_HelloWorld, _type_HelloWorld, _type_HelloWorldResponse );
    _prepOperation( op );
    op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/HelloWorld" );
    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;
    }

    return Data_fromObject((Object[])resultObj);
}

private static Data Data_fromObject( Object obj[] ) {
    if(obj == null) return null;
    Data result = new Data();
    result.setIntData(((Integer )obj[0]).intValue());
    result.setStringData((String )obj[1]);
    result.setDoubleData(((Double )obj[2]).doubleValue());
    return result;
}

I debug the code and in Run time resultObj has one element witc is an array of the Data object , so in parsing the values in the Data_fromObject method it expect many cells like we see in the code obj[0] , obj[1] , obj [2] but in realtime it has obj[0][0] , obj[0][1] , obj[0][2]

What can be the problem , how can check the code generation issue ? Is it a problem with the web service side.

Please help. Thanks in advance...

A: 

Have u find any solution for this ? i have same problem. plz tell me any solution

Yes, I used the Wireless toolkit Stub generator utility . I also generate a client code accessing a web service , and it seems ok , there's no problem there.
Wasim
A: 

return JqData_ArrayfromObject((Object[]) resultObj); }

private static JqData[] JqData_ArrayfromObject( Object obj[] ) { if(obj == null) return null; JqData result[] = new JqData[obj.length]; for( int i = 0; i < obj.length; i++ ) { result[i] = new JqData(); Object[] oo = (Object[]) obj[i]; result[i].setId(((Integer )oo[0]).intValue()); result[i].setData((String )oo[1]); } return result; }

Here, m getting my value at obj[0][0][0], obj[0][0][1] instead of obj[0], obj[1]; Plz tell me what will be the solution

Rakhi