Java beans spec require that setter and getter must have form
get<propName>, set<propName>.
On 3/14/07, Ehrlich, Martin (Vorsorge) <[EMAIL PROTECTED]> wrote:
Hi,
I found some – in my eyes – very strange behaviour.
I try to get an instance of the class ProcessState back from my WebService
(running XFire 1.2.5 on JBoss). This is a POJO containing just another POJO
called ProcessDescriptor.
(ProcessDescriptor is a class I already use in another WS and it works quite
well.)
ProcessState looks like this:
public class ProcessState implements Serializable {
private ProcessDescriptor procDesc;
public ProcessState() {
super();
this.procDesc = new ProcessDescriptor();
}
public final void setProcDesc(ProcessDescriptor procDesc) {
this.procDesc = procDesc;
}
public final ProcessDescriptor getProcessDescriptor() {
return procDesc;
}
}
I get this exception:
Exception in thread "main"
org.codehaus.xfire.XFireRuntimeException: Could not invoke
service.. Nested exception is
org.codehaus.xfire.fault.XFireFault: No write method for
property {http://jbpmServices}processDescriptor in class
jbpmServices.ProcessState
org.codehaus.xfire.fault.XFireFault: No write method for
property {http://jbpmServices}processDescriptor in class
jbpmServices.ProcessState
I do not understand why this happens because there is no property called
ProcessDesriptor. The property is called procDesc.
When I change the method name to
public final void
setProcessDescriptor(ProcessDescriptor procDesc) {
this.procDesc = procDesc;
}
it runs flawlessly. Is this logical? ProcessDescriptor is the type of the
property not the property itself!
I would really like to know why this code runs. ;-)
Thanks,
Martin
PS: For completeness here the class ProcessDescriptor:
public class ProcessDescriptor implements Serializable {
private String processName = "";
private long id;
private boolean suspended = true;
public final long getId() {
return id;
}
public final void setId(long id) {
this.id = id;
}
public final String getProcessName() {
return processName;
}
public final void setProcessName(String processName) {
this.processName = processName;
}
public final boolean isSuspended() {
return suspended;
}
public final void setSuspended(boolean suspended) {
this.suspended = suspended;
}
}
--
-----
When one of our products stops working, we'll blame another vendor
within 24 hours.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email