I'm writing a java client for a WCF REST service. This service uses lots of different data classes for communication, transmitted in JSON. On my side, I'm using the Gson lib to do handle the serialization of these classes. However for this to work, I obviously need the Java definitions of the used C# classes.
Currently I'm writing these by hand: I check the C# class definitions, check which property has a [DataMember] annotation and create a corresponding java class with those properties. This is a terrible solution: it's slow, tedious and difficult to keep these classes up to date manually.
What tools / method should I use to generate these classes somehow from their C# counterparts? Is writing some .net console app that generates java classes using reflection the only solution?
You can try a tool like wsdl4j to create a proxy java file and just use the class definitions in it.
精彩评论