axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "R J Scheuerle Jr" <>
Subject Re: Collection Ser/Des
Date Wed, 27 Mar 2002 15:17:44 GMT
How did you get a stub with a return of java.util.Collection.  I don't see
how WSDL2Java could produce this kind of stub.

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)

                      "David L. Cole"                                                    
                      <DLCole@cmsenergy        To:      
                      .com>                    cc:                                    
                                               Subject:  Collection Ser/Des              
                      03/26/2002 06:53                                                   
                      Please respond to                                                  

I have a method which returns a Collection. Below is the generated client
stub which accurately shows it will return a Collection.
However, the actual object typ of resp is Object[]. This causes a
    public java.util.Collection retrieveContractListForAsset() throws
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        com.rbs.base.client.remote.RBSCall call = getCall();
        call.setReturnType(new javax.xml.rpc.namespace.QName
("", "Collection"));
        call.setOperationName(new javax.xml.rpc.namespace.QName
("", "retrieveContractListForAsset"));

        Object resp = call.invoke(new Object[] {});

        if (resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)resp;
        else {
             return (java.util.Collection) resp;

Currently to fix the problem, I modify the return line to the following:

             return (java.util.Collection)java.util.Arrays.asList((Object

The only side effect from this is that the client which called the method
should new a collection and pass in the return value from the stub
into the constructor which will copy the collection contents to the new
collection object.

i.e Collection col = new Vector( returnFromStubMethod);
or Collection col = new ArrayList( returnFromStubMethod);

Is there any plan to fix the stub generation or alternate suggestions?

David Cole

View raw message