Show TOC

Procedure documentationCreating and Editing the job-definition.xml Locate this document in the navigation structure

 

The job-definition.xml is an additional descriptor which identifies the message-driven bean as a JobBean.

Use the procedures below to create a job-definition.xml file for the HelloJob and update its content.

Procedure

Creating a job-definition.xml
  1. In the Project Explorer, right-click the META-INF folder of the HelloJobProject, and then choose   New   Other  .

  2. On the New screen that opens, proceed as follows:

    1. Choose   XML   XML  , and then choose Next.

    2. Choose Create XML from scratch, and then choose Next.

    3. In the File name field, enter job-definition.xml, and then choose Finish.

Updating the Content of the job-definition.xml
  1. In the Project Explorer, from the META-INF folder of the HelloJobProjectopen the job-definition.xml file.

  2. On the Source tab page, edit the file as the sample below shows.

    Example Example

    1. <job-definitions>
          <job-definition name="HelloJob"
          				description="Logs a string and calculates its length">
            <job-definition-parameter name="UserName"
                                      data-type="String"
                                      direction="IN"/>
         <job-definition-parameter name="NameLength"
                                      data-type="Integer"
                                      direction="OUT"/>
          </job-definition>
      </job-definitions>
      
    End of the code.

    In the job-definition.xml file of the HelloJob, you have to specify the name of the job definition. It has to be the same as the job name specified in the message selector in the JobBean class. For more information, see Developing the JobBean Class of the HelloJob].

    In addition, you have to declare the name, data type, and direction of the job parameters used in the HelloJobBean class.

    With the UserName parameter, which is of type string, you provide specific input for the job when you schedule the job. That is why, it has to be declared as a parameter with direction IN. With the NameLength parameter, which is of type integer, the job provides particular output (in this case, it logs a message in the database). That is why, it has to be declared as a parameter with direction OUT. The values for parameter direction are not case-sensitive.

    Caution Caution

    Make sure that in the job-definition.xml you specify the correct parameter data types that you set in the JobBean class. If there is a mismatch between the data types of the job parameters from the JobBean class and the job-definition.xml, the job will not be fully operational.

    End of the caution.

    Optionally, you can specify a description of the job definition which is displayed in Job Management in the SAP NetWeaver Administrator.

    For more information about the Document Type Definition (DTD) of job-definition.xml, see Job-definition.dtd

  3. Save the file.