Adding Codelets not working

Printer-friendly version

Hi, I have a problem creating and adding a new codelet. I correctly followed the various tutorials found. The engine log presents an error, but it just says "error with plugin x". I set up the web.xml file also. Nothing worked, please check my codelet inplementation and feel free to ask further details, thank you

ahense's picture

Hi, I have looked at your codelet. It compiles and can be selected in the YAWL editor. I had the problem that the datatype in YAWL was called "String", so I changed the codelet like this

***

 YParameter param1 = new YParameter(null, YParameter._INPUT_PARAM_TYPE);
            param1.setDataTypeAndName("string", "username", XSD_NAMESPACE);
            param1.setDocumentation("appuser username");
            params.add(param1);
            
            YParameter param2 = new YParameter(null, YParameter._INPUT_PARAM_TYPE);
            param2.setDataTypeAndName("string", "password", XSD_NAMESPACE);
            param2.setDocumentation("appuser password");
            params.add(param2);

***

When I try to run it I have a different problem:

2017-03-16 12:27:25,532 [ERROR] CodeletRunner        :- Exception executing codelet 'codelet.PrepareDataTaskCodelet': Parameter 'username' is required by the specified codelet but could not be found in the workitem's parameters.. Codelet could not be executed; default value returned for workitem '437.1:A'
2017-03-16 12:27:25,750 [ERROR] ResourceManager      :- Automated task '437.1:A' could not be successfully completed. Result message: <failure><reason>Problem with process model.  Schema validation failed
Task [A]
XQuery [null]
Document []
Schema for Expected [<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="A">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="isValidUser" type="xs:boolean" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>]
But received [<A />]
Validation error message [Error: 1:6: cvc-complex-type.2.4.b: The content of element 'A' is not complete. One of '{isValidUser}' is expected.
]</reason></failure>
 

The problem is you have overridden the 'setInputs' method, which prevents the superclass from initialising the input values correctly. To fix, remove the overridden 'setInputs' method from your class.