I'm not a huge JAXB/JAX-WS guy, but: he's probably right.
One pattern we use internally for this--since when you're sending objects across a web service boundary, you're basically flattening them into something that's expressible solely with the vocabulary of your WS-I profile--is to manually serialize whatever object you're attempting to send, and provide some context for the process of deserialization via an enum understood by the caller and the service.
In the following simple example, DemuxEnum
would be an enum that contains values for all of the types you want to send:
MyObject obj = new MyObject();
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
ObjectOutputStream objectOut = new ObjectOutputStream(byteOutStream);
objectOut.writeObject(obj);
objectOut.close();
byte[] serializedObject= byteOutStream.toByteArray();
someWSObject.SendObject(DemuxEnum.MyObjectType, serializedObject);
Where you've already set up a web service endpoint that takes (DemuxEnum, byte[])
. For bonus points, you can toss in alternate serializer/deserializer technologies like Apache Thrift or Google ProtocolBuffers.
Edit: The obvious downside of this is that if it's a customer-facing web service, that's just not going to jive. You're probably better off enumerating web methods that have concrete parameters, if that's the case.