Topic
  • 32 replies
  • Latest Post - ‏2014-08-01T11:15:26Z by 1UWC_Anoop_Varambally
Arco_Synobsys
Arco_Synobsys
19 Posts

Pinned topic BPM 7.5 using REST API's

‏2011-07-08T11:27:09Z |
Hi there,

I'm working on a project where I want to build my own user interfaces for handling BPM coaches (don't ask me why), I did this before for WPS using the REST api's.
Right now I'm investigating the REST api's provided in BPM 7.5 for the BPD resources.
At this time I'm able to get task information with "/rest/bpm/wle/v1/task/{taskId}?parts={string}".
The question is how to get access to the input and output values of the coach and how to update them.
Thanks in advance,
Arco
Updated on 2012-06-18T23:31:23Z at 2012-06-18T23:31:23Z by RhettWhaley
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-08T18:54:27Z  
    It's important to understand the different between a human service and a "coach".
    The task represents to human service. If you retrieve the task details you will get the inputs as well as the data model for the task.
    The human service may also include a coach which is used to display data that may or may not directly correlate with the task parameters, but in general will be used to set output parameters. These are not hard and fast rules, human services don't have to have any input or output variables, especially if you are building highly interactive coaches (i.e. AJAX). But, the general user case is that there will be some correlation between task inputs, the coach and task outputs.

    That said, you don't interact with the coach directly, rather, the API interacts with the human service. You use the "finish" command to complete a task, the finish command can take parameters that will be written into the service as output parameters.

    The idea is that you are processing the task outside the confines of the IBM BPM service engine.
    API's exist to manipulate parameters within the context of the human service as well as it's containing service/bpd, as such you manipulate these parameters directly, then, finish the task.

    Hope this is clear.
  • Arco_Synobsys
    Arco_Synobsys
    19 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-10T08:26:18Z  
    It's important to understand the different between a human service and a "coach".
    The task represents to human service. If you retrieve the task details you will get the inputs as well as the data model for the task.
    The human service may also include a coach which is used to display data that may or may not directly correlate with the task parameters, but in general will be used to set output parameters. These are not hard and fast rules, human services don't have to have any input or output variables, especially if you are building highly interactive coaches (i.e. AJAX). But, the general user case is that there will be some correlation between task inputs, the coach and task outputs.

    That said, you don't interact with the coach directly, rather, the API interacts with the human service. You use the "finish" command to complete a task, the finish command can take parameters that will be written into the service as output parameters.

    The idea is that you are processing the task outside the confines of the IBM BPM service engine.
    API's exist to manipulate parameters within the context of the human service as well as it's containing service/bpd, as such you manipulate these parameters directly, then, finish the task.

    Hope this is clear.
    Hi there,

    First of all thanks for your response.
    Some questions left, I do understand Task is the representation of human service which can contain one or more coaches.
    First of all when I get the details of a task with "GET /rest/bpm/wle/v1/task/{taskId}?parts={string}" I do get the task details but the data tag is empty while the human service contains input and output parameters, how come?
    Secondly can you tell me when to use the "service" APIs when I try to run "GET /rest/bpm/wle/v1/service/{instanceId}?action={string}&parts={string}" with the service id found in the task details the answer is that the service doesn't exist.
    Last question is which APIs to use to update the input and output of the service I did have a look at "PUT /rest/bpm/wle/v1/task/{taskId}?action={string}&dueDate={string}&priority={string}&parts={string}" and "PUT /rest/bpm/wle/v1/task/{taskId}?action={string}&parts={string}¶ms={string}" but it's not clear to me how to use those to update the data.
    Thanks in advance,
    Arco
  • Arco_Synobsys
    Arco_Synobsys
    19 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-15T10:00:56Z  
    Hi there,

    First of all thanks for your response.
    Some questions left, I do understand Task is the representation of human service which can contain one or more coaches.
    First of all when I get the details of a task with "GET /rest/bpm/wle/v1/task/{taskId}?parts={string}" I do get the task details but the data tag is empty while the human service contains input and output parameters, how come?
    Secondly can you tell me when to use the "service" APIs when I try to run "GET /rest/bpm/wle/v1/service/{instanceId}?action={string}&parts={string}" with the service id found in the task details the answer is that the service doesn't exist.
    Last question is which APIs to use to update the input and output of the service I did have a look at "PUT /rest/bpm/wle/v1/task/{taskId}?action={string}&dueDate={string}&priority={string}&parts={string}" and "PUT /rest/bpm/wle/v1/task/{taskId}?action={string}&parts={string}¶ms={string}" but it's not clear to me how to use those to update the data.
    Thanks in advance,
    Arco
    Nobody ?
    Did some further investigation but it seems like most of the APIs only work partly or don't work at all.
  • JeoffWilks
    JeoffWilks
    29 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-15T16:23:37Z  
    Nobody ?
    Did some further investigation but it seems like most of the APIs only work partly or don't work at all.
    If you want to see the data as soon as you query the task details, then use an External Activity as your implementation. Then you'll see the inputs as part of the data. For example, in this case I created an external activity with a "name" input and then passed in "jeoff" as the name. As soon as I query the task, I see the name:

    data: {
    bpdToken: { ... },
    variables: {
    name: "jeoff"
    }
    },
    externalActivityID: "60.0d0c47ac-0a4f-4bb8-86a3-cd412fd98bfc"

    Now if you want to use regular Human Services but replace just insert your custom UI in place of the Coach steps within those services, then you will have to use the Start Task call. That will pass the inputs from the BPD Instance into the Task, and from that point on they'll be visible within data.variables. The service will proceed until it hits a Coach, where it will stop. To proceed from there, use the Resume Service call, passing in the Task ID and a Button action.

    In the community version of the REST API, it was possible to see the Inputs to the service, prior to starting it, even when not implemented as an External Activity. This would allow you to implement a placeholder Service which you could later bypass, treating it functionally as an External Activity. In any case I'm not certain this is what you would want, because it isn't clear to me from your comments whether you want to drive your custom UI entirely as an External Activity or still use the Human Service workflow engine (replacing only the Coach steps with custom UI).
  • JeoffWilks
    JeoffWilks
    29 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-15T16:32:01Z  
    If you want to see the data as soon as you query the task details, then use an External Activity as your implementation. Then you'll see the inputs as part of the data. For example, in this case I created an external activity with a "name" input and then passed in "jeoff" as the name. As soon as I query the task, I see the name:

    data: {
    bpdToken: { ... },
    variables: {
    name: "jeoff"
    }
    },
    externalActivityID: "60.0d0c47ac-0a4f-4bb8-86a3-cd412fd98bfc"

    Now if you want to use regular Human Services but replace just insert your custom UI in place of the Coach steps within those services, then you will have to use the Start Task call. That will pass the inputs from the BPD Instance into the Task, and from that point on they'll be visible within data.variables. The service will proceed until it hits a Coach, where it will stop. To proceed from there, use the Resume Service call, passing in the Task ID and a Button action.

    In the community version of the REST API, it was possible to see the Inputs to the service, prior to starting it, even when not implemented as an External Activity. This would allow you to implement a placeholder Service which you could later bypass, treating it functionally as an External Activity. In any case I'm not certain this is what you would want, because it isn't clear to me from your comments whether you want to drive your custom UI entirely as an External Activity or still use the Human Service workflow engine (replacing only the Coach steps with custom UI).
    Meant to say: "Now if you want to use regular Human Services but just insert your custom UI in place of the Coach steps within those services, then you will have to use the Start Task call."

    When driving the task via an External Activity, use this call sequence:
    1. Task Details (input data is visible immediately)
    2. Finish Task (provide output data)

    When driving the task via a regular Human Service that contains coaches, use this call sequence:
    1. Task Details
    2. Start Task (input data, plus initialization data up to the first coach, is visible at this point)
    3. For each Coach encountered
    a. Get Data
    b. Set Data
    c. Resume Service (pass in Task ID and Button Action)
    4. Finish Task (if task was not already completed by a previous call)
  • JeoffWilks
    JeoffWilks
    29 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-15T16:42:05Z  
    Meant to say: "Now if you want to use regular Human Services but just insert your custom UI in place of the Coach steps within those services, then you will have to use the Start Task call."

    When driving the task via an External Activity, use this call sequence:
    1. Task Details (input data is visible immediately)
    2. Finish Task (provide output data)

    When driving the task via a regular Human Service that contains coaches, use this call sequence:
    1. Task Details
    2. Start Task (input data, plus initialization data up to the first coach, is visible at this point)
    3. For each Coach encountered
    a. Get Data
    b. Set Data
    c. Resume Service (pass in Task ID and Button Action)
    4. Finish Task (if task was not already completed by a previous call)
    Lastly, if you aren't already aware of it, be sure to check out the REST API testing tool, which is included out of the box on your server at:

    http://<hostname>:<port>/bpmrest-ui/
  • Arco_Synobsys
    Arco_Synobsys
    19 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-19T07:52:57Z  
    Meant to say: "Now if you want to use regular Human Services but just insert your custom UI in place of the Coach steps within those services, then you will have to use the Start Task call."

    When driving the task via an External Activity, use this call sequence:
    1. Task Details (input data is visible immediately)
    2. Finish Task (provide output data)

    When driving the task via a regular Human Service that contains coaches, use this call sequence:
    1. Task Details
    2. Start Task (input data, plus initialization data up to the first coach, is visible at this point)
    3. For each Coach encountered
    a. Get Data
    b. Set Data
    c. Resume Service (pass in Task ID and Button Action)
    4. Finish Task (if task was not already completed by a previous call)
    Hi Jeoff,

    First of all thanks for your response, this helped me a lot.
    The approach I'm using will be
    "When driving the task via a regular Human Service that contains coaches, use this call sequence:
    1. Task Details
    2. Start Task (input data, plus initialization data up to the first coach, is visible at this point)
    3. For each Coach encountered
    a. Get Data
    b. Set Data
    c. Resume Service (pass in Task ID and Button Action)
    4. Finish Task (if task was not already completed by a previous call)"

    I tried to do this for the "Hiring sample" process.
    Step 1 is ok.
    Step 2 is ok, the data response contains ""{"instanceId":"235","currentPosition":{"replacement":{}},"requisition":{"instanceId":"235","date":"2011-07-19T07:40:03Z"},"Arco":"Arco van der velden"}","
    Step 3 I can't get the "Get Data" on the service object to work, I expect to get the value of the field "Arco" for instance when using
    http://sosvmsdevelop:9081/rest/bpm/wle/v1/service/280?action=getData&field=Arco
    But this isn't the case, I'm getting an error "ReferenceError: "Arco" is not defined"

    Can you please explain to me how to get and set the data with the services?
    Thanks in advance,
    Arco
  • Arco_Synobsys
    Arco_Synobsys
    19 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-21T10:26:54Z  
    Hi Jeoff,

    First of all thanks for your response, this helped me a lot.
    The approach I'm using will be
    "When driving the task via a regular Human Service that contains coaches, use this call sequence:
    1. Task Details
    2. Start Task (input data, plus initialization data up to the first coach, is visible at this point)
    3. For each Coach encountered
    a. Get Data
    b. Set Data
    c. Resume Service (pass in Task ID and Button Action)
    4. Finish Task (if task was not already completed by a previous call)"

    I tried to do this for the "Hiring sample" process.
    Step 1 is ok.
    Step 2 is ok, the data response contains ""{"instanceId":"235","currentPosition":{"replacement":{}},"requisition":{"instanceId":"235","date":"2011-07-19T07:40:03Z"},"Arco":"Arco van der velden"}","
    Step 3 I can't get the "Get Data" on the service object to work, I expect to get the value of the field "Arco" for instance when using
    http://sosvmsdevelop:9081/rest/bpm/wle/v1/service/280?action=getData&field=Arco
    But this isn't the case, I'm getting an error "ReferenceError: "Arco" is not defined"

    Can you please explain to me how to get and set the data with the services?
    Thanks in advance,
    Arco
    Hi All,

    Ok found out how to get the data by myself, I have to use tw.local.Arco instead of Arco so forget about my previous post.

    I've got this working when using the api tester in the browser doing the following steps.
    1. Start task "{baseURL}/rest/bpm/wle/v1/task/{taskID}?action=start"
    2. Get Data "{baseURL}/rest/bpm/wle/v1/service/{instanceID}?action=getData&field=tw.local"

    When I tried to do the same steps in java an error occurs in step 2.
    1. /rest/bpm/wle/v1/task/353?action=start
    response:"{"status":"200","data":{"activationTime":"2011-07-20T12:14:11Z","clientTypes":,"completionTime":null,"containmentContextID":"303","description":null,"displayName":"Step: Register customer requirements","dueTime":"2011-07-20T13:14:11Z","kind":"KIND_PARTICIPATING","lastModificationTime":"2011-07-20T12:14:11Z","name":"Register customer requirements","originator":"tw_admin","owner":"tw_user","priority":30,"startTime":"2011-07-20T12:14:11Z","state":"STATE_CLAIMED","tkiid":"353","piid":"303","status":"Received","priorityName":"Normal","assignedTo":"tw_user","assignedToType":"user","data":{},"serviceID":"1.926331ee-d618-4e73-bf1d-12d44087451d"}}"

    2. /rest/bpm/wle/v1/service/353?action=getData&field=tw.local
    response:"{"status":"error","Data":{"status":"error","exceptionType":"com.ibm.bpm.wle.api.ObjectDoesNotExistException","errorNumber":"CWTBG0013E","errorMessage":"CWTBG0013E: The object '353' does not exist; it might have been deleted in the meantime.","errorMessageParameters":}}"

    Can anyone help me out with this ?
  • GC07
    GC07
    22 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-07-27T17:45:41Z  
    Hi All,

    Ok found out how to get the data by myself, I have to use tw.local.Arco instead of Arco so forget about my previous post.

    I've got this working when using the api tester in the browser doing the following steps.
    1. Start task "{baseURL}/rest/bpm/wle/v1/task/{taskID}?action=start"
    2. Get Data "{baseURL}/rest/bpm/wle/v1/service/{instanceID}?action=getData&field=tw.local"

    When I tried to do the same steps in java an error occurs in step 2.
    1. /rest/bpm/wle/v1/task/353?action=start
    response:"{"status":"200","data":{"activationTime":"2011-07-20T12:14:11Z","clientTypes":,"completionTime":null,"containmentContextID":"303","description":null,"displayName":"Step: Register customer requirements","dueTime":"2011-07-20T13:14:11Z","kind":"KIND_PARTICIPATING","lastModificationTime":"2011-07-20T12:14:11Z","name":"Register customer requirements","originator":"tw_admin","owner":"tw_user","priority":30,"startTime":"2011-07-20T12:14:11Z","state":"STATE_CLAIMED","tkiid":"353","piid":"303","status":"Received","priorityName":"Normal","assignedTo":"tw_user","assignedToType":"user","data":{},"serviceID":"1.926331ee-d618-4e73-bf1d-12d44087451d"}}"

    2. /rest/bpm/wle/v1/service/353?action=getData&field=tw.local
    response:"{"status":"error","Data":{"status":"error","exceptionType":"com.ibm.bpm.wle.api.ObjectDoesNotExistException","errorNumber":"CWTBG0013E","errorMessage":"CWTBG0013E: The object '353' does not exist; it might have been deleted in the meantime.","errorMessageParameters":}}"

    Can anyone help me out with this ?
    Hi Arco,

    in a project were I'm involved, we are using an approach similar to yours and we also got the error "CWTBG0013E: The object '353' does not exist; it might have been deleted in the meantime.".

    The server stores some information in a session and in our case we were always creating a new session in every request. To solve this problem we had to send back the session cookie, received in the first request to the server, in every subsequent requests.

    Hope this helps...

    By the way, were you able to use the setData with a complex type variable? For instance, we have a variable like this:
    RequestData:
    {
    ShippingAddress:
    {
    State: "",
    Zip:"",
    Street:"",
    City:""
    },
    ShippingAddressSameAsBillingAddress:false,
    Approved:false,
    Amount:0,
    BillingAddress:
    {
    State:"",
    Zip:"",
    Street:"",
    City:""
    },
    Id:203,
    Name:"",
    Date:"2011-07-27T15:07:19Z"
    }

    and if we call
    http://localhost:9080/rest/bpm/wle/v1/service/258?action=setData&field=tw.local.RequestData&value={"ShippingAddress":{"State":"","Zip":"","Street":"","City":""},"ShippingAddressSameAsBillingAddress":false,"Approved":false,"Amount":0.0,"BillingAddress":{"State":"","Zip":"","Street":"","City":""},"Id":203,"Name":"","Date":"2011-07-27T15:07:19Z"}

    (the value parameter is decode for legibility) this raises the error
    com.ibm.bpm.wle.api.UnexpectedFailureException: CWTBG0019E: Unexpected exception during execution. com.lombardisoftware.core.TeamWorksException: [TeamworksException name='Error', message='Internal Script error: com.lombardisoftware.core.TeamWorksRuntimeException: com.lombardisoftware.core.TeamWorksException: Type mismatch. Value "

    Thanks for your help.
  • SystemAdmin
    SystemAdmin
    7615 Posts

    activity, task, taskless and HTTP session

    ‏2011-08-03T09:59:25Z  
    Hi All,

    Ok found out how to get the data by myself, I have to use tw.local.Arco instead of Arco so forget about my previous post.

    I've got this working when using the api tester in the browser doing the following steps.
    1. Start task "{baseURL}/rest/bpm/wle/v1/task/{taskID}?action=start"
    2. Get Data "{baseURL}/rest/bpm/wle/v1/service/{instanceID}?action=getData&field=tw.local"

    When I tried to do the same steps in java an error occurs in step 2.
    1. /rest/bpm/wle/v1/task/353?action=start
    response:"{"status":"200","data":{"activationTime":"2011-07-20T12:14:11Z","clientTypes":,"completionTime":null,"containmentContextID":"303","description":null,"displayName":"Step: Register customer requirements","dueTime":"2011-07-20T13:14:11Z","kind":"KIND_PARTICIPATING","lastModificationTime":"2011-07-20T12:14:11Z","name":"Register customer requirements","originator":"tw_admin","owner":"tw_user","priority":30,"startTime":"2011-07-20T12:14:11Z","state":"STATE_CLAIMED","tkiid":"353","piid":"303","status":"Received","priorityName":"Normal","assignedTo":"tw_user","assignedToType":"user","data":{},"serviceID":"1.926331ee-d618-4e73-bf1d-12d44087451d"}}"

    2. /rest/bpm/wle/v1/service/353?action=getData&field=tw.local
    response:"{"status":"error","Data":{"status":"error","exceptionType":"com.ibm.bpm.wle.api.ObjectDoesNotExistException","errorNumber":"CWTBG0013E","errorMessage":"CWTBG0013E: The object '353' does not exist; it might have been deleted in the meantime.","errorMessageParameters":}}"

    Can anyone help me out with this ?
    Hi Arco,

    Lombardi runtime is meant to execute business processes (the BPDs).

    <<
    An activity is a box on a BPD; it's part of the model. The task is the record of the activity for a specific instance of a process. Within a BPD instance, the engine creates a task most of the time when it encounters an activity. There are some exceptions (e.g. Embedded Javascript) which are executed inline. Many people use these terms interchangeably, and conceptually (from a BPMN standpoint) there may not even be a difference. But from an implementation standpoint, certain activities can be executed taskless -- the tradeoff is you get better performance due to less database writes, in exchange for less safety due to lack of nonvolatile data storage.
    >>

    When a service is executed directly, not as part of a BPD, is usually executed taskless. Optionally can be executed using a task.
    Note that these services won't have a record in the database and are referenced together with the HTTP session id - meaning it won't be persisted between 2 http calls or two different browser session, like GC07 described and probably whats happening to you.

    This also happens starting services from the Process Designer (not only with the REST API).
    In the Process Designer you normally run a service to test it, and this is usually done without a task.

    In the playback menu you'll find more options:
    - Run Service
    - Debug Service
    - Run Service with Task
    - Debug Service with Task

    The same is available for the REST API using the 'createTask' field.

    POST /rest/bpm/wle/v1/service/{instanceId}?action={string}&createTask={boolean}&parts={string}

    http://publib.boulder.ibm.com/infocenter/dmndhelp/v7r5mx/topic/com.ibm.wbpm.bspace.ref.doc/bpmrest-docs/rest_bpm_wle_v1_service_instanceid_post_start.htm
    In conclusion, you can
    - test your services in the taskless manner using the same browser session, confident that it will work between 2 sessions when it is executed inside a BPD instance.
    - if it is important and a special service with this requirement, you can also start the service and also create task.
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-08-05T16:21:12Z  
    Hi, is Step 3.a really necessary? Isn't it so that startTask tells us about the data when calling the service or does the data I receive by calling startTask differ from the data I receive by calling *getData*?
  • Arco_Synobsys
    Arco_Synobsys
    19 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-08-09T11:17:15Z  
    Hi, is Step 3.a really necessary? Isn't it so that startTask tells us about the data when calling the service or does the data I receive by calling startTask differ from the data I receive by calling *getData*?
    I don't think step 3a is necessary, it gives you the same data when starting the task.
  • Arco_Synobsys
    Arco_Synobsys
    19 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-08-09T11:22:57Z  
    • GC07
    • ‏2011-07-27T17:45:41Z
    Hi Arco,

    in a project were I'm involved, we are using an approach similar to yours and we also got the error "CWTBG0013E: The object '353' does not exist; it might have been deleted in the meantime.".

    The server stores some information in a session and in our case we were always creating a new session in every request. To solve this problem we had to send back the session cookie, received in the first request to the server, in every subsequent requests.

    Hope this helps...

    By the way, were you able to use the setData with a complex type variable? For instance, we have a variable like this:
    RequestData:
    {
    ShippingAddress:
    {
    State: "",
    Zip:"",
    Street:"",
    City:""
    },
    ShippingAddressSameAsBillingAddress:false,
    Approved:false,
    Amount:0,
    BillingAddress:
    {
    State:"",
    Zip:"",
    Street:"",
    City:""
    },
    Id:203,
    Name:"",
    Date:"2011-07-27T15:07:19Z"
    }

    and if we call
    http://localhost:9080/rest/bpm/wle/v1/service/258?action=setData&field=tw.local.RequestData&value={"ShippingAddress":{"State":"","Zip":"","Street":"","City":""},"ShippingAddressSameAsBillingAddress":false,"Approved":false,"Amount":0.0,"BillingAddress":{"State":"","Zip":"","Street":"","City":""},"Id":203,"Name":"","Date":"2011-07-27T15:07:19Z"}

    (the value parameter is decode for legibility) this raises the error
    com.ibm.bpm.wle.api.UnexpectedFailureException: CWTBG0019E: Unexpected exception during execution. com.lombardisoftware.core.TeamWorksException: [TeamworksException name='Error', message='Internal Script error: com.lombardisoftware.core.TeamWorksRuntimeException: com.lombardisoftware.core.TeamWorksException: Type mismatch. Value "

    Thanks for your help.
    @GC07
    Ok that seems to be the solution then, can you tell me how to send back the session cookie in a request ?

    According to you question about setting the data, there seems to be a problem with this, I've got the following message from IBM.
    "Just an FYI, there is a defect for the REST API, it can only retireve simple type data, like string or int, it cannot retireve a complex type BOs.
    An APAR JR39911 already opened for this problem. If your data is a simple type, it should works.
    "
  • GC07
    GC07
    22 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-08-09T11:39:01Z  
    @GC07
    Ok that seems to be the solution then, can you tell me how to send back the session cookie in a request ?

    According to you question about setting the data, there seems to be a problem with this, I've got the following message from IBM.
    "Just an FYI, there is a defect for the REST API, it can only retireve simple type data, like string or int, it cannot retireve a complex type BOs.
    An APAR JR39911 already opened for this problem. If your data is a simple type, it should works.
    "
    Arco,

    we are using the Jersey API to talk with the server and I just had to set the property DefaultApacheHttpClientConfig.PROPERTY_HANDLE_COOKIES to true.

    DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
    config.getProperties().put(DefaultApacheHttpClientConfig.PROPERTY_HANDLE_COOKIES, true);
    config.getState().setCredentials(null, null, -1, "username", "password");

    ApacheHttpClient client = ApacheHttpClient.create(config);

    This client instance must be used in all requests of the same session.

    Hope this helps.
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-08-09T19:24:48Z  
    Developing on Android makes it difficult to maintain the connection over several intents.
  • JeoffWilks
    JeoffWilks
    29 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-03T04:44:34Z  
    Let me know if there are any outstanding questions on this thread.
  • kolban
    kolban
    3322 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-10T17:26:59Z  
    Let me know if there are any outstanding questions on this thread.
    Hi guys,
    I'm having a heck of a time trying to use the getData REST method. I have a BPD with an Activity that is implemented by a Human Service. In that Human Service, I am trying to get some data from that service. What I seem to find is that when I call the getData method, I get the dreaded:

    "CWTBG0013E: The object 'xxx' does not exist; it might have been deleted in the meantime."

    message. I have seen the following TechNote:

    http://www-01.ibm.com/support/docview.wss?uid=swg21509210

    But even when I try it with the REST API Tester and look at the FireBug log which shows both JSESSIONID and LtpaToken2 being passed, I get the same error. I am thinking out loud that I am not able to make this API call unless a previous API call started the Task ... but that doesn't smell right? Has anyone had any better luck/experience than myself.

    Neil
  • padamstx
    padamstx
    51 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-13T18:08:46Z  
    • kolban
    • ‏2011-09-10T17:26:59Z
    Hi guys,
    I'm having a heck of a time trying to use the getData REST method. I have a BPD with an Activity that is implemented by a Human Service. In that Human Service, I am trying to get some data from that service. What I seem to find is that when I call the getData method, I get the dreaded:

    "CWTBG0013E: The object 'xxx' does not exist; it might have been deleted in the meantime."

    message. I have seen the following TechNote:

    http://www-01.ibm.com/support/docview.wss?uid=swg21509210

    But even when I try it with the REST API Tester and look at the FireBug log which shows both JSESSIONID and LtpaToken2 being passed, I get the same error. I am thinking out loud that I am not able to make this API call unless a previous API call started the Task ... but that doesn't smell right? Has anyone had any better luck/experience than myself.

    Neil
    Neil,
    Unfortunately, you hit on the answer in your post. In order to use the REST API with getData and setData, you need to also use the REST API to start the task in addition to using the same HTTP session. We recognize this as a problem and we plan to fix it in a future release/fixpack. You can contact me offline for more details.

    Phil Adams | Engineering Manager, IBM BPM Development | IBM - Austin, TX
  • kolban
    kolban
    3322 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-13T18:57:09Z  
    • padamstx
    • ‏2011-09-13T18:08:46Z
    Neil,
    Unfortunately, you hit on the answer in your post. In order to use the REST API with getData and setData, you need to also use the REST API to start the task in addition to using the same HTTP session. We recognize this as a problem and we plan to fix it in a future release/fixpack. You can contact me offline for more details.

    Phil Adams | Engineering Manager, IBM BPM Development | IBM - Austin, TX
    Thanks Phil. I'll hold off on working on this area until a future release/fixpack. I did try making the Task: Start Task API call prior to Service: Get Data and that worked ... but only after I had to change the 99Local.XML setting to enable JavaScript evaluation (which was a surprise as I hadn't thought that a get of data would need JavaScript evaluation to be enabled).

    Neil
  • GC07
    GC07
    22 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-14T10:47:11Z  
    • padamstx
    • ‏2011-09-13T18:08:46Z
    Neil,
    Unfortunately, you hit on the answer in your post. In order to use the REST API with getData and setData, you need to also use the REST API to start the task in addition to using the same HTTP session. We recognize this as a problem and we plan to fix it in a future release/fixpack. You can contact me offline for more details.

    Phil Adams | Engineering Manager, IBM BPM Development | IBM - Austin, TX
    Phil,

    is there a planed date for when this fix will be available?

    Thanks,
    Gabriel
  • padamstx
    padamstx
    51 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-14T15:16:50Z  
    • GC07
    • ‏2011-09-14T10:47:11Z
    Phil,

    is there a planed date for when this fix will be available?

    Thanks,
    Gabriel
    Gabriel,
    Unfortunately, I'm not able to discuss un-announced plans on this forum. I think your best bet is to open a PMR for this issue so that you are notified about a possible fix and you can interact with the support organization, etc.
    Phil Adams | Engineering Manager, IBM BPM Development | IBM - Austin, TX
  • padamstx
    padamstx
    51 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-14T15:29:14Z  
    • kolban
    • ‏2011-09-13T18:57:09Z
    Thanks Phil. I'll hold off on working on this area until a future release/fixpack. I did try making the Task: Start Task API call prior to Service: Get Data and that worked ... but only after I had to change the 99Local.XML setting to enable JavaScript evaluation (which was a surprise as I hadn't thought that a get of data would need JavaScript evaluation to be enabled).

    Neil
    Neil,
    Setting and retrieving variables involves javascript execution, so it is secured in a fashion similar to the actual "evaluate javascript" APIs. I noticed that the docs do not mention this explicitly so I'll try to update them in the next refresh.

    Phil Adams | Engineering Manager, IBM BPM Development | IBM - Austin, TX
  • kolban
    kolban
    3322 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-15T00:34:16Z  
    • padamstx
    • ‏2011-09-14T15:29:14Z
    Neil,
    Setting and retrieving variables involves javascript execution, so it is secured in a fashion similar to the actual "evaluate javascript" APIs. I noticed that the docs do not mention this explicitly so I'll try to update them in the next refresh.

    Phil Adams | Engineering Manager, IBM BPM Development | IBM - Austin, TX
    Thank you Phil, that would be wonderful. We sure do appreciate your attention to the forum questions. I am now wondering to myself what the implications of needing to switch on JavaScript execution to get/set variables might be to the broader story? If I understand correctly, there is a REST API that allows one to execute arbitrary JavaScript in the context of a service. This is extremely powerful but, also, by its very nature ... an unbounded and potential risky/insecure concept. I notice that the product has this ability switched off by default and hence we need to explicitly enable it to use the variable getters/setters. I am wondering if the REST API for getters/setters, even if it uses JavaScript processing internally, can be "brought out" of the JavaScript execution sandbox? It strikes me that the REST API for variable getters and setters do not allow arbitrary JavaScript to be executed and hence can be potentially "trusted" by the runtime. Its just a thought and a low priority one at that. If we wish, I will be happy to raise a requirement to get such a request logged.

    Neil
  • GC07
    GC07
    22 Posts

    Re: BPM 7.5 using REST API's

    ‏2011-09-15T14:57:16Z  
    • padamstx
    • ‏2011-09-14T15:16:50Z
    Gabriel,
    Unfortunately, I'm not able to discuss un-announced plans on this forum. I think your best bet is to open a PMR for this issue so that you are notified about a possible fix and you can interact with the support organization, etc.
    Phil Adams | Engineering Manager, IBM BPM Development | IBM - Austin, TX
    Phil,

    we already have a PMR open for this issue (PMR 81169,756,000). Can you please check it and give us more details through it?

    Thanks,
    Gabriel