JAX-WS and Joda-Time?

后端 未结 4 587
挽巷
挽巷 2020-12-11 01:39

How do I write a JAX-WS service so the @WebParam of my @WebMethod is a Joda-Time class like DateTime? Will @XmlTypeAdapter on a parameter work? I\'m deploying to GlassFish

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 02:22

    You have to annotate the parameter directly such as below (I am making use of XSDDateTimeMarshaller written by @DennisTemper as one of the answers to your question but feel free to substitute with another one...) :

    @WebService
    @SOAPBinding(style = SOAPBinding.Style.RPC)
    public interface Resender {
        @WebMethod
        void resend(
            @WebParam(name = "start") @XmlJavaTypeAdapter(type = DateTime.class, value = XSDDateTimeMarshaller.class) DateTime start,
            @WebParam(name = "end") @XmlJavaTypeAdapter(type = DateTime.class, value = XSDDateTimeMarshaller.class) DateTime end
        );
    }
    

提交回复
热议问题