i have a web service working like this:
@WebService(serviceName = "TempService")
public class TempService {
@WebMethod(operationName = "addBarkod")
public Boolean addBarkod(@WebParam(name = "barkod") Barkod barkod) {
System.out.println(barkod.getBarkodNo());
}
}
and the Barkod class as:
public class Barkod {
private String barkodNo;
// there are constructors and getters, setters etc. nothing fancy //
}
with this structure my web service can be called with soapUI wtihout a problem. the problem is when i want to annotate my model class with JAXB annotations like:
@XmlType(name="barkod")
@XmlRootElement(name="barkod")
@XmlAccessorType(XmlAccessType.FIELD)
i can deploy this to glassfish 3.1 and soapUI generates new client request with new structure but when it comes to do “barkod.getBarkodNo();” at addBarkod operation it throws a NullPointerException. i looks like the XML i sent to the web service does not create a proper Barkod object.
do i have to do with web service class or something?
i think problem caused because soapUI generates the request automatically from my WSDL. when i annotate my class with @XmlRootElement without the namespace clause it does not map given XML to may object. i assign @XmlRootElemen(namespace=””) and my problem goes away.
thanks for responses anyway.