cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Working with Interfaces using JAX-WS
Date Wed, 12 Aug 2009 20:43:55 GMT

It's done the same way as what you are going for the Map below.   You need to 
write a @XmlJavaTypeAdapter thing to map the Credential to/from a concrete 
class.

Most likely, in your case, the adapter would map Credential <--> 
BaseCredential  and you would then use XmlSeeAlso annotations to register the 
concrete subtypes (PasswordCredential plus others).

Dan


On Tue August 11 2009 3:30:27 pm Suneet Shah wrote:
> Hello:
>
> How do you deal with or annotate interfaces in JAX-WS? I have the class
> below that has a variable of type "Credential".  Credential in this case
> is an interface and is set using Spring's dependency injection.  I have
> pasted below the code for the interface and the implementation classes.
> I am not sure what I should be annotating and how.:
>
> public class AuthenticationContextImpl implements Serializable,
> AuthenticationContext {
>
> private String authenticationType;
> private String resourceId;
> private Credential credential;
> private String domainId;
> private String principal;
> private String password;
> @XmlJavaTypeAdapter(ObjectMapAdapter.class)
> private Map<String,Object> authParam = new HashMap();
>
>
> Above Credential is an interface. I have an implement to the interface,
> but I am not sure how to deal with this.
>
> public interface Credential {
>
> }
>
> public abstract class BaseCredential implements Credential {
>
>     public BaseCredential() {
>
>     }
> }
>
>
> XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "PasswordCredential", propOrder = {
>     "domainId",
>     "principal",
>     "password"
> })
> public class PasswordCredential extends BaseCredential {
>
>     String domainId;
>     String principal;
>     String password;
>
>     public PasswordCredential() {
>
>     }
>
>
> Thanks
> Suneet

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message