Make sure your getters and setters refer to the same name ie
setProcDesc(...) and getProcDesc() - this code should run ok. Then, brush up
on JavaBeans and the difference between a field and a property.




On 14/03/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;

            }

}













Reply via email to