package com.sample;
@WebService(serviceName = "sampleEndPoint")
public class SampleEndPoint {
@WebMethod
public boolean sampleWebMethod(@WebParam(name = "parameter") int parameter){
return true;
}
}
After the compilation of this class, we may want to generate request and response classes of this service. wsgen command is used for this purpose:
wsgen -keep -verbose -cp . com.sample.SampleEndPoint
After the generation is done, we have two Java classes. One is for request and the other is for the response.
Request class is:
@XmlRootElement(name = "sampleWebMethod", namespace = "http://sample.com/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sampleWebMethod", namespace = "http://sample.com/")
public class Trigger {
@XmlElement(name = "parameter", namespace = "")
private int parameter;
public int getParameter() {
return this.parameter;
}
public void setParameter(int parameter) {
this.parameter= parameter;
}
}
and the response class is:
@XmlRootElement(name = "sampleWebMethodResponse", namespace = "http://sample.com/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sampleWebMethodResponse", namespace = "http://sample.com/")
public class SampleWebMethodResponse {
@XmlElement(name = "return", namespace = "")
private boolean _return;
public boolean isReturn() {
return this._return;
}
public void setReturn(boolean _return) {
this._return = _return;
}
}