<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Drools XML error when passing process variables to work item
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/dmwpepper">David Harris</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/811284#811284">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I've been reading through "Section 7.2.3, Using your new work item in your processes"&#160; to see how to pass process variables to a work item.&#160; Even though the values of each process variable are getting passed each work item, I'm getting the following XML error in the Eclipse console:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><table><tbody><tr><td style=";">1</td><td style=";">02/05 11:43:16,406[main] ERROR drools.xml.ExtensibleXmlParser.error&#160; - (null: 40, 62): cvc-id.2: There are multiple occurrences of ID value '_4_Source_IPInput'.</td></tr><tr><td style=";">4</td><td style=";">02/05 11:43:16,409[main] ERROR drools.xml.ExtensibleXmlParser.error&#160; - (null: 40, 62): cvc-attribute.3: The value '_4_Source_IPInput' of attribute 'id' on element 'dataInput' is not valid with respect to its type, 'ID'.</td></tr><tr><td style=";">5</td><td style=";">02/05 11:43:16,410[main] ERROR drools.xml.ExtensibleXmlParser.error&#160; - (null: 41, 64): cvc-id.2: There are multiple occurrences of ID value '_4_Start_DateInput'.</td></tr><tr><td style=";">5</td><td style=";">02/05 11:43:16,410[main] ERROR drools.xml.ExtensibleXmlParser.error&#160; - (null: 41, 64): cvc-attribute.3: The value '_4_Start_DateInput' of attribute 'id' on element 'dataInput' is not valid with respect to its type, 'ID'.</td></tr><tr><td style=";">6</td><td style=";">02/05 11:43:16,411[main] ERROR drools.xml.ExtensibleXmlParser.error&#160; - (null: 42, 60): cvc-id.2: There are multiple occurrences of ID value '_4_End_DateInput'.</td></tr><tr><td style=";">6</td><td style=";">02/05 11:43:16,411[main] ERROR drools.xml.ExtensibleXmlParser.error&#160; - (null: 42, 60): cvc-attribute.3: The value '_4_End_DateInput' of attribute 'id' on element 'dataInput' is not valid with respect to its type, 'ID'.</td></tr></tbody></table><p><span style="color: #ff0000;"><strong>parameters passed into work item: 111.111.111.111, 2013 05 02 09:00:00, 2013 04 02 09:00:00</strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Note the last line in red shows the values are being passed.&#160; Does anyone see anything in the folllowing that would cause the Drools XML error?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>**********</p><p>public class ProcessMain {</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public static final void main(String[] args) throws Exception {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // load up the knowledge base</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; KnowledgeBase kbase = readKnowledgeBase();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // start a new process instance</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Map&lt;String,Object&gt; params = new HashMap&lt;String,Object&gt;();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; params.put("processIP", "111.111.111.111");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; params.put("processStartDate", "2013 05 02 09:00:00");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; params.put("processEndDate", "2013 04 02 09:00:00");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ksession.getWorkItemManager().registerWorkItemHandler("IP Conversations", new IPConversationsWorkItemHandler());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ksession.startProcess("com.sample.bpmn.hello",params);</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; private static KnowledgeBase readKnowledgeBase() throws Exception {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return kbuilder.newKnowledgeBase();</p><p>&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; </p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>***********</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The Work Item Handler is:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>**********</p><p>package com.sample;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>import org.drools.runtime.process.WorkItem;</p><p>import org.drools.runtime.process.WorkItemHandler;</p><p>import org.drools.runtime.process.WorkItemManager;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>import java.sql.*;</p><p>import java.util.*;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public class IPConversationsWorkItemHandler implements WorkItemHandler {</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; public void executeWorkItem (WorkItem workItem, WorkItemManager manager) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // extract parameters</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String sourceIP = (String) workItem.getParameter("Source_IP");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String startDate = (String) workItem.getParameter("Start_Date");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String endDate = (String) workItem.getParameter("End_Date");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("parameters passed into work item: " + sourceIP + "," + startDate + "," + endDate);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // notify manager that work item has been completed</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; manager.completeWorkItem(workItem.getId(),null);</p><p>&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; </p><p>&#160;&#160;&#160; public void abortWorkItem (WorkItem workItem, WorkItemManager manager) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // do nothing, not planning to abort operation at this time</p><p>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>*********</p><p>*********</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The work item definition file has the following entry:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>import org.drools.process.core.datatype.impl.type.StringDataType;</p><p>[</p><p>&#160; [</p><p>&#160;&#160;&#160; "name" : "IP Conversations",</p><p>&#160;&#160;&#160; "parameters" : [</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; "Source_IP" : new StringDataType(),</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; "Start_Date" : new StringDataType(),</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; "End_Date" : new StringDataType()</p><p>&#160;&#160;&#160; ],</p><p>&#160;&#160;&#160; "results" : [</p><p>&#160;&#160;&#160; "Source_IPs" : new StringDataType(),</p><p>&#160;&#160;&#160; "Source_Ports" : new StringDataType(),</p><p>&#160;&#160;&#160; "Dest_IPs" : new StringDataType(),</p><p>&#160;&#160;&#160; "Dest_Ports" : new StringDataType(),</p><p>&#160;&#160;&#160; "Recv_Time"&#160; : new StringDataType()</p><p>&#160;&#160;&#160; ],</p><p>&#160;&#160;&#160; "displayName" : "IP Conversations"</p><p>&#160; ],</p><p>]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>********</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/811284#811284">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>