FilterService in BlackPearl ?

  • 12 December 2007
  • 4 replies
  • 0 views

Badge +5

Hello,


In K2.NET 2003 I had a function that used the FilterService webservice to retrieve the contents of a Process XML Field. I assigned the returned string in a typed dataset to use on my WebForm.


What is the recommended way to do this in BlackPearl ? Is there also a webservice available to retrieve data ?


Thanks,


Nicolas


4 replies

Badge +10
I do not know of a webservice to do this but it can be easily done through the API. Would that help?
Badge +5

Hi,


Is it in the same API where you can open a worklistitem, start a process, etc ?


What are the recommended functions and methods to do this ? (it is for a management tool, so it must also be used on finished workflows)

Badge +9

If you are trying to retrieve it from an active worklist item then the SourceCode.Workflow.Client.dll can be used (this replaces K2.net 2003's K2ROM... the object model is nearly identical to K2ROM).


If you are trying to get the XML field for any process, regardless of status or who it may be assigned to, which I suspect may be what you're doing since you where using FilterService in K2 2003 (which pulled data from the K2Log, reporting, database), then you can utilize the out-of-box ProcessXML SmartObject.


In case you are not familiar there are many SmartObjects that ship with K2 and are used by K2.  These can be accessed various ways.  Below is an example method showing how you can retrieve the XML value for a given Process Instance ID and XML Field Name via the SmartObject .NET Data Provider:


 


    private string GetProcessXMLField(string strK2Server,
                                    uint nPortNum,
                                    int nProcessInstanceID,
                                    string strProcessXmlFieldName)
    {
        /*
           This requires references to be added to the following K2 DLL's:
               
                SourceCode.Hosting.Client.BaseAPI.dll
                SourceCode.SmartObjects.Client.dll
                SourceCode.Data.SmartObjectsClient.dll
        
           These should be in C:Program FilesK2 blackpearlin
         
           You will probably also need a reference to:
        
                System.Data
        


    NOTE: the default smartobject port number is 5555
        */


        string strXML = String.Empty;


        // make the connection
        string strConn = "Server=" + strK2Server + ";Port= " + nPortNum.ToString() + ";AutoAlias=False;SmartObjects=Process_XML";
        SourceCode.Data.SmartObjectsClient.SOConnection oConn = new SourceCode.Data.SmartObjectsClient.SOConnection(strConn);


        // build out the query
        string strSQL = "SELECT Process_XML.List.XMLValue ";
        strSQL += "FROM Process_XML.List ";
        strSQL += "WHERE Process_XML.List.ProcessInstanceID = " + nProcessInstanceID + " ";
        strSQL += "AND Process_XML.List.XMLName = '" + strProcessXmlFieldName + "' ";


        // create a command from this query
        SourceCode.Data.SmartObjectsClient.SOCommand oCmd = new SourceCode.Data.SmartObjectsClient.SOCommand(strSQL, oConn);


        // get a data reader
        SourceCode.Data.SmartObjectsClient.SODataReader oRdr = oCmd.ExecuteReader(CommandBehavior.CloseConnection);
        // check the results
        if (oRdr != null)
        {
            if (oRdr.Read())
            {
                strXML = oRdr["XMLValue"].ToString();
            }
            oRdr.Close();
        }


        return strXML;
    }


 

Badge +13

Is there documentation on what objects/table that can be retrieved using ADO .NET SmartObject provider?

e.g. Process_XML.List in your example.

Reply