I want to know if I put a generics method in jax-ws, like:
public List<MyCustomClass> getSomething()
Does the jax-ws support this? On the client side what will the return of the method looks like?
I want to know if I put a generics method in jax-ws, like:
public List<MyCustomClass> getSomething()
Does the jax-ws support this? On the client side what will the return of the method looks like?
You will get a List in the client side (or an array of MyCustomClass objects if the WS consumer is written in another language). That won't be a problem. Remember to always program to interfaces.
Looks like you still don't have much practice creating WS in Java, so I'll give you some advices:
You must not send 2 or more objects that contains a circular reference, or you will end with circular reference problems. This is because the JAX-WS tool will create an interminable XML response for the request. It could be very hard to discover. Let's see a case:
You must always have interfaces in your return classes, not specific Java library classes. This means, your classes should have
List
,Set
andMap
(in case of containers), because this interfaces are in higher level than the implementation classes, and you could get problems if a non-Java client tries to consume your web service method.The classes that will go through your web services should be POJOs (Plain Old Java Objects), not service or business logic layer classes. Why? Because only the attributes values will be marshalled/unmarshalled when communicating with the clients, no method code will appear in the contract of your Web Service.
I've faced these three problems in my last SOA project with Java. I hope other people could enhance this answer or provide info with links.
Yes, that should not be a problem but usages of array is recommended. As Luiggi mentioned you would receive a
List<MyCustomClass>
. To add more to can find complete listing of supported types by JAX-WS here