axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Diephouse <...@envoisolutions.com>
Subject Re: Serializing Lists and Arrays
Date Mon, 05 May 2003 20:00:43 GMT
OK, well I just started poking around and doing things.  What I ended up 
doing was changing the ServiceDesc after it was loaded to an array class 
instead of a List so the WSDL generates correctly.  Since it gets 
serialized to an array anyway, I don't think it matters.  But, second 
opinions are welcome.  I have tests that modify the ServiceDesc at 
runtime, generate wsdl, run the service, and generate working clients 
from the service (although only in java) - so there hasn't been any 
kickback yet.

I used commons-attributes get meta-data of what kind of array to return. 
  If anyone here is even interested you can look at these:
http://blogs.codehaus.org/projects/ivory/archives/000004.html
http://cvs.codehaus.org/viewcvs.cgi/ivory/src/java/org/codehaus/ivory/axis/IvoryServiceDesc.java?rev=HEAD&cvsroot=plexus&content-type=text/vnd.viewcvs-markup

Still working on serializers for beans which aren't directly referenced 
by the service interface.

- Dan


Dan Diephouse wrote:
> Hi all,
> 
> I'm starting to plug away again with Axis. So, I noticed I don't like to 
> use Arrays in my code so much as I like to use Lists.  I searched on 
> google and through the docs for ways to tell Axis to serialize a List to 
> an array of a specified object, but found nothing.  Is that possible 
> currently through the API or WSDD?  I think I must be missing something.
> 
> If I'm not, I would like to write some (de)serializers that check for 
> metadata in my classes with commons attributes.  For instance, if my 
> class has a method that returns a List I want to be able to tell Axis to 
> take that list and make it into an array of some object that I specify 
> in the metadata.  Or I could even tell the BeanSerializer (or the new 
> serializer that I'm making) not to serialize certain bean methods by 
> adding the appropriate metadata.  Would Axis be interested in some code 
> that does this?
> 
> Quick example:
> 
> public class MyService
> {
>     /**
>      * I am telling axis to serialize this as an array of Strings
>      * @axis.returnarray java.lang.String
>      */
>     public List getCitys( String state );
> 
>     /**
>      * This method is not exposed.
>      * @axis.noexposure
>      */
>     public void rereadCitysFromHardDrive();
> }
> 
> Then, when I expose my service, my serializer would like for this 
> metadata and take appropriate action.  Obviously, I haven't thought much 
> about nomenclature of the metadata, but you get the point.
> 
> Also, does Axis have an IRC hangout? If not, people are welcome to come 
> onto irc.codehaus.org:6667.  I'll hang out in #axis and see if anyone 
> shows up.
> 
> Regards,
> 
> - Dan
> 
> P.S. for those who don't know, Commons Attributes allows you to put 
> metadata in your source code in the javadoc. Then, it compiles the 
> metadata and allows you to access it at runtime.
> 
> -- 
> Dan Diephouse
> http://junktoast.com
> 
> 
> 


-- 
Dan Diephouse
http://junktoast.com
"Everyone knows that Custer died at the Battle of
Little Big Horn. What this book presupposes is....
maybe he didn't?" -- Eli Cash, Royal Tenenbaums



Mime
View raw message