javax.xml.bind.annotation annotations all being ignored
hitman_in_wis Jan 5, 2007 4:35 PMHi, my name is Brett, and my company is pretty new to java web services, but we need to use them to communicate between PowerBuilder and EJB3.
As far as I can tell, it looks like the annotations from the javax.xml.bind.annotation are being completely ignored in our deployed web services. Below is an example:
The web service class...
package com.nsighttel.ejb.services.validation.creditcard;
import java.io.Serializable;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import com.nsighttel.domain.MonthYearWS;
@Stateless
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public class CreditCardVerificationServiceWS implements Serializable {
private static final long serialVersionUID = 1L;
@WebMethod
public int isValid(
@WebParam(name = "cardExp")MonthYearWS cardExpWS
){
return 1;
}
}
And the class for the WebParam...
package com.nsighttel.domain;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlAccessType;
@XmlAccessorType(XmlAccessType.FIELD)
public class MonthYearWS implements Serializable {
private static final long serialVersionUID = 1L;
private Boolean isNull;
private Integer month;
private Integer year;
@XmlTransient private MonthYear obj;
public MonthYearWS(Boolean isNull, Integer month, Integer year) {
this.isNull = isNull;
this.month = month;
this.year = year;
if (isNull == null || !isNull){
obj = new MonthYear(month,year);
}
}
public Boolean getIsNull() {
return isNull;
}
public void setIsNull(Boolean isNull) {
this.isNull = isNull;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
@XmlTransient
public MonthYear getObj(){
return obj;
}
public void setObj(MonthYear obj){
this.obj = obj;
}
}
No matter what annotations I use, I get isNull, month, year, and obj all in my WSDL file for the above web service. The @XmlTransient annotation on the getObj() function is not being honored, as I am still getting obj in the WSDL file. Furthermore, if I take away all of the public getter functions, then I get no elements in my WSDL file. Therefore, the @XmlAccessorType(XmlAccessType.FIELD) is not being honored either.
I have tried a few other annotations from the javax.xml.bind.annotation package, but none of them appear to be working either.
Could someone please clue me in to what I may be doing wrong? Does Jboss not support these annotations? Or maybe the annotations do not apply to web services?
Any help is greatly appreciated.
Thanks!
-Brett Birschbach