Showing results for 
Search instead for 
Do you mean 

Example Rules Services Code

by Community Manager Community Manager ‎04-18-2016 10:57 AM - edited ‎04-18-2016 10:58 AM

Assumes that rule services are running on <RuleServicesAppServer>.

The Javadoc API documentation is located on the rules services server at:

http://<RuleServicesAppServer>:8080/ModelServicesWS/index.html

You’ll want to look at the ModelServices class for the API methods that are available.

 

Example:

Assumes your model services are exposed on <webserver>

Using the supported proxy, a simple Rule Services application looks like this (code-wise, assuming the correct configuration in the app.config file as well):

 

using System;

using Rulestream.RuleServicesWS.RuleServices;

namespace RuleServicesDemo

{

    class Program

    {

        static string userID = "fred";

        static string password = "";

        static string profileName = "test";

        static string projectID = "XXX000001";

        static int lineItemID = 1;

        static int processID = 16;

 

        static void Main(string[] args)

        {

            Session s = null;

            int widthPropID = 45;

            string width = "178.3";

            int heightPropID = 63;

            string height = "33.2";

            int jtSpecID = 42;

 

            s = new Session();

            s.login(userID, password, profileName);

 

            // ...

 

            s.LoadModel(projectID, lineItemID, processID);

 

            // ...

 

            s.SetPropertyValue(widthPropID, width);

            s.SetPropertyValue(heightPropID, height);

 

            s.CreateOutput(s.GetTopLevelPart(), jtSpecID, "Implant3D", false);

 

            // refer to resulting JT via URL after CreateOutput call:

            // http://webserver/ModelServicesWS/resource/file/output/Implant3D.jt

 

            s.logout();

            s.endSession();

        }

    }

}

Contributors