Using the JAXB annotated class for the JAXWS service

I have a web service that works as follows:

@WebService(serviceName = "TempService")
public class TempService {
  @WebMethod(operationName = "addBarkod")
  public Boolean addBarkod(@WebParam(name = "barkod") Barkod barkod) {
    System.out.println(barkod.getBarkodNo());
  }
}

and barcode class like:

public class Barkod {
  private String barkodNo;
// there are constructors and getters, setters etc. nothing fancy //
}

With this structure, my web service can be called using soapUI without any problems. the problem is when I want to annotate a model class with JAXB annotations, for example:

@XmlType(name="barkod")
@XmlRootElement(name="barkod")
@XmlAccessorType(XmlAccessType.FIELD)

I can deploy this to Glassfish 3.1, and soapUI generates a new client request with a new structure, but when it comes to "barkod.getBarkodNo ();" when addBarkod is running, it throws a NullPointerException. It seems to me that the XML sent to the web service does not create a suitable Barkod object.

Am I related to a web services class or something else?

+3
source share
1 answer

, , soapUI WSDL. @XmlRootElement , XML-, . @XmlRootElemen (namespace = ""), .

.

0

All Articles