ECL Webservice Metastorm BPM v9

Hi everyone!

 

Anyone who has any documentation or sample code about how to use the ECL Webservice in version 9.  I need to be able to start and submit a blank form action with c# code.

 

 

Appreciate any help,

 

Magnus

Tagged:

Comments

  • You can use ECL library starting any process you want in v9 too. SDK is not availble at this time but maybe i can help you. 

     

    We have received a email listener .net application from metastorm which starts for every received email a new process with email subject, body and attachments too. We rewrite this .net application and have migrate this from v7.6 to v9. I try to introduce which steps are necessary:

     

    1. New .net Application in VS2010 with .net4

      

    1. becauce SDK is not available i have imported every assembly i found in \ECL.WS\bin and \Engine Directory (not very nice but i have to look for changing namespaces from v7->v9)

     

    using Metastorm.ECL.TPObjects;
    using Metastorm.ECL;
    using Metastorm.ECL.RequestBroker;
    using Metastorm.ECL.Support;
    using Metastorm.Engine.Common;
    using Metastorm.Engine.Errors;
    using Metastorm.Engine.Interface;
    using Metastorm.Engine.Authentication;
    using Metastorm.PS.Listener;
    

     

    1. create Session  and Login

      

    ISessionConfigurer2 sessionConfigurer2 = new ESessionConfigurer(); sessionConfigurer2.ConfigLocation = ListenerConfiguration.BPMConfigurationFile; // Path to EngineServiceConfig.xml
    
    1. Login  (at time we did not test SSO Login in V9, manual Login works)

      // Create a new session
      FieldList loginData = new FieldList();
      loginData.Add("username", new Field("nt4user",
      ListenerConfiguration.BPMUsername));

                  m_bpmSession = sessionConfigurer2.CreateSession2();
                  m_bpmSession.ServiceName = ListenerConfiguration.BPMService;
      
                  try //try SSO
                  {
                      m_bpmSession.Login("WEB;SSO", "0", loginData);
                  }
                  catch //try normal Login
                  {
                      m_bpmSession.Login(ListenerConfiguration.BPMUsername,                           ListenerConfiguration.BPMPassword);
                  }
      
                  if (!m_bpmSession.LoggedIn)
                  {
                      // error
                  }
      

     

     4. start process and submit

    // start process
    ActionResponse action = m_bpmSession.StartAction(null, 'MyProcess', 'FirstAction', false, null);
    
    //may be our start form has only a subject field
    ((Field)action.Action.Fields2['subject']).Value = 'subject'
    
    // submit the folder    
    SubmitResponse submitRsp = action.Action.Submit();
    

    This shortly describes how to start a new process with c#

    Hope this helps you

     

    Thilo 

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • Hi Thilo, thanks for the reply - please note this approach should not be followed as it directly accesses v9 Internal ECL code which will not be supported. There will be a seperate web service to allow v7 ECL developers to continue to use their code with a v9 system.

     

     

     

    Our forthcoming SDK - will include samples to explain how this is possible.

     

     

    To answer the original question regarding web services the following should help. The documentation will contain other samples as well, but hopefully this will get you started. 

     

     

     

    Add a service reference EclWSSvc to the project, pointing at http://localhost/ECL.WS/Service.svc  

     

    A Metastorm Client should then declare a ServiceClient object, and ServiceSessionState The client and server configurations contain information about the service binding and location

     

     

     

    In your client app.config suggest increasing default sizes for the following

     

    maxBufferSize ="41943040"

     

    maxReceivedMessageSize ="41943040"

     

    maxStringContentLength ="41943040"

     

    maxArrayLength ="41943040"

     

     

     

     

     

    private EclWSSvc.ServiceClient eclWS;

     

    private EclWSSvc.ServiceSessionState eclServiceSession = null;

     

    eclWS = new Metastorm.ECL.WSClient.EclWSSvc.ServiceClient();

     

     

     

    Provide authentication detail ... eg.

     

     

     

      FormField[] loginData = new FormField[] {

     

    new TextField() { Name = "username", Value = "some username", Culture = CultureInfo.InvariantCulture.ToString() },

     

    new TextField() { Name = "password", Value = PasswordEncrypt("some password"), Culture = CultureInfo.InvariantCulture.ToString() }

     

      };

     

      eclServiceSession = this.eclWS.Login("WEB;", 0, "", loginData);

     

    if (eclWS.IsLoggedIn(eclServiceSession))

     

    {

     

        // Can carry out authenticated operations here...

     

    }

     

     

     

    You need to encrypt the password, I believe the other hyperlink has an example of this. This will be documented & available in the sample clients that come with the SDK.

    The SDK client side interfaces will do this encryption for you.

     

     

     

    To work with a list do something like as follows (demonstrates how to obtain the first page of 10 blank forms, ordered by map name.

     

     )

     

     

         DataSet ds = new DataSet();

     

     

     

    ListResult clientData = this.eclWS.GetList(eclServiceSession,   ListContentsType.Blank, null, "eMapName", "", 1, 10);

     

         string ClientDataOutput = clientData.Data;

     

     

     

    System.IO.StringReader xmlSR = new System.IO.StringReader(ClientDataOutput);

     

         ds.ReadXml(xmlSR, XmlReadMode.ReadSchema);

     

       dataGridView1.DataSource = ds.Tables[0];

     

       dataGridView1.Refresh;

     

     

     

     

     

    You might then try and perform an action

     

     

     

    DataRow alertRow = ds.Tables[0].Rows[0];
          ActionResponse response = eclWS.StartAction(eclServiceSession, alertRow["eFolderID"] as string, alertRow["eMapName"] as string, "action name", false, null);
                // User can refill, cancel, or submit action here...

     

    And then logout...
                eclWS.Logout(eclServiceSession); 

     

     

    Hope this helps

     

    Rich

     

  • Upps...could you answer the following questions:

     

    1. Use of ECL in v7 is documented (PDF) and supported?!

    2. Use of ECL in V9 is not supported?!

     

    Regards,

    Thilo

  • Hey Thilo, apologies for the delay in responding.

     

    Not sure if you've now downloaded the SDK - did our documentation answer the questions you were looking for?

     

    To summarise direct use of Metastorm.ECL, Metastorm.ECL.Support is supported for existing ECL solutions that use 7.6 documented classes. (My earlier comment regarding "There will be a seperate web service to allow v7 ECL developers to continue to use their code with a v9 system" is no longer valid - we decided we could offer a much more backwards compatibility - by removing this service).

     

    V9 ECL solutions - should use either ECL.WS or ECL.NET SDK Client side interfaces (Metastorm.ECL.Client, Metastorm.ECL.Client.Contracts. Direct access of undocumented classes for v9 feature access -  Metastorm.ECL/Metastorm.ECL.Support are for internal use only.and are unsupported.

     

    Hope this helps you.

     

    Best Regards

     

    Rich

  • Noonsy,

     

    Could you please supply a link for the SDK download.

    I've implemented the service as described above and consistently get the following when trying to test the login:

     

    Unable to login: The request failed with HTTP status 401: Unauthorized.

     

    I have tried a number of different configurations of the service within IIS7, all to no avail.

     

    Any help appreciated.

     

    Nils.

  • Ok I can start a process (blank form action) just fine. But i now want to access an actual action and that looks to be a little trickier, does anyone have a sample accessing a specific action for a folder?