1 2 Previous Next 19 Replies Latest reply on Jan 13, 2015 7:45 AM by Maciej Swiderski

    How to Receiving Rest Calls with Map type Object?

    Antonio Giambanco Novice

      Hi all,

      a client needs to call my process (start process) trough REST.

      Since the message to be sent contains Map type element I would like to understand how I need to configure my process properties in the KIE WB.

      Do I need to configure the "Variable Definitions" property with a custom type element?

       

      Thanks

        • 1. Re: How to Receiving Rest Calls with Map type Object?
          Maciej Swiderski Master

          you can either declare variable that will be of type map or wrap it with some object. Both should work without an issue.

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: How to Receiving Rest Calls with Map type Object?
            Antonio Giambanco Novice

            Hi

            I created my class from the data modeler using all strings and then I edited just two attributes type (List and Map), here my class

            package com.objectway.advisory.signature;

             

            import java.util.HashMap;

            import java.util.List;

            import java.util.Map;

             

            /**

            * This class was automatically generated by the data modeler tool.

            */

             

            @org.kie.api.definition.type.Label(value = "InstanceInputData")

            public class InstanceInputData implements java.io.Serializable {

             

                static final long serialVersionUID = 1L;

             

                @org.kie.api.definition.type.Label(value = "itemId")

                @org.kie.api.definition.type.Position(value = 0)

                private java.lang.String itemId;

               

                @org.kie.api.definition.type.Label(value = "sourceItemId")

                @org.kie.api.definition.type.Position(value = 1)

                private java.lang.String sourceItemId;

             

                @org.kie.api.definition.type.Label(value = "userSortType")

                @org.kie.api.definition.type.Position(value = 2)

                private java.lang.String userSortType;

               

                @org.kie.api.definition.type.Label(value = "provisioningUser")

                @org.kie.api.definition.type.Position(value = 3)

                private java.lang.String provisioningUser;

               

                @org.kie.api.definition.type.Label(value = "checkInDateCEST")

                @org.kie.api.definition.type.Position(value = 4)

                private java.lang.String checkInDateCEST;

             

                @org.kie.api.definition.type.Label(value = "checkOutDateCEST")

                @org.kie.api.definition.type.Position(value = 5)

                private java.lang.String checkOutDateCEST;

             

                @org.kie.api.definition.type.Label(value = "inputChannel")

                @org.kie.api.definition.type.Position(value = 6)

                private java.lang.String inputChannel;

             

               

                @org.kie.api.definition.type.Label(value = "infos")

                @org.kie.api.definition.type.Position(value = 7)

                private Map<String, Object> infos = new HashMap<String, Object>();

               

                @org.kie.api.definition.type.Label(value = "users")

                @org.kie.api.definition.type.Position(value = 8)

                private List<String> users;

             

                public InstanceInputData() {

                }

               

                public InstanceInputData(java.lang.String itemId, java.lang.String sourceItemId, java.lang.String userSortType, java.lang.String provisioningUser, java.lang.String checkInDateCEST, java.lang.String checkOutDateCEST, java.lang.String inputChannel, java.util.List<String> users, java.util.Map<String, Object> infos) {

                    this.itemId = itemId;

                    this.sourceItemId = sourceItemId;

                    this.userSortType = userSortType;

                    this.provisioningUser = provisioningUser;

                    this.checkInDateCEST = checkInDateCEST;

                    this.checkOutDateCEST = checkOutDateCEST;

                    this.inputChannel = inputChannel;

                    this.users = users;

                    this.infos = infos;

                }

             

                public java.lang.String getCheckInDateCEST() {

                    return this.checkInDateCEST;

                }

               

                public void setCheckInDateCEST(java.lang.String checkInDateCEST) {

                    this.checkInDateCEST = checkInDateCEST;

                }

             

                public java.lang.String getCheckOutDateCEST() {

                    return this.checkOutDateCEST;

                }

               

                public void setCheckOutDateCEST(java.lang.String checkOutDateCEST) {

                    this.checkOutDateCEST = checkOutDateCEST;

                }

             

                public java.lang.String getInputChannel() {

                    return this.inputChannel;

                }

               

                public void setInputChannel(java.lang.String inputChannel) {

                    this.inputChannel = inputChannel;

                }

             

                public java.lang.String getItemId() {

                    return this.itemId;

                }

               

                public void setItemId(java.lang.String itemId) {

                    this.itemId = itemId;

                }

             

                public java.lang.String getProvisioningUser() {

                    return this.provisioningUser;

                }

               

                public void setProvisioningUser(java.lang.String provisioningUser) {

                    this.provisioningUser = provisioningUser;

                }

             

                public java.lang.String getSourceItemId() {

                    return this.sourceItemId;

                }

               

                public void setSourceItemId(java.lang.String sourceItemId) {

                    this.sourceItemId = sourceItemId;

                }

             

                public java.lang.String getUserSortType() {

                    return this.userSortType;

                }

               

                public void setUserSortType(java.lang.String userSortType) {

                    this.userSortType = userSortType;

                }

               

                public Map<String, Object> getInfos() {

                    return infos;

                }

             

                public void setInfos(Map<String, Object> infos) {

                    this.infos = infos;

                }

               

             

            }

             

            when done I opened my class from data modeler again and here what I see:

             

            datamodeler.jpg

             

            I lost attribute Map infos and users attribute is now a string array instead of a List, is it ok?

            • 3. Re: How to Receiving Rest Calls with Map type Object?
              Maciej Swiderski Master

              do you mean that you added manually these fields (List and Map) and not via data modeler? If so in 6.1 there was not source code preserving feature in data modeler so such operation is not really supported. You should be able to achieve that in 6.2 tough so go ahead and give it a try with latest CR of 6.2.

               

              HTH

              • 4. Re: How to Receiving Rest Calls with Map type Object?
                Antonio Giambanco Novice

                Hi

                do I need to install again the entire jbpm or I can just deploy the new .war file?

                 

                thanks

                • 6. Re: How to Receiving Rest Calls with Map type Object?
                  Antonio Giambanco Novice

                  Hi

                   

                  "{\"JBAS014671: Failed services\" => {\"jboss.deployment.unit.\\\"jbpm-console.war\\\".WeldStartService\" => \"org.jboss.msc.service.StartException in service jboss.deployment.unit.\\\"jbpm-console.war\\\".WeldStartService: Failed to start service

                      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ProjectService with qualifiers @Default

                    at injection point [BackedAnnotatedField] @Inject org.kie.workbench.common.services.backend.validation.JavaFileNameValidator.projectService

                    at org.kie.workbench.common.services.backend.validation.JavaFileNameValidator.projectService(JavaFileNameValidator.java:0)

                  \"}}"

                  • 7. Re: How to Receiving Rest Calls with Map type Object?
                    Maciej Swiderski Master

                    what version are you using? downloaded from?

                    • 9. Re: How to Receiving Rest Calls with Map type Object?
                      Maciej Swiderski Master

                      best to rely on CR3 version rather snapshot, so give it a try with war file from this location.

                       

                      HTH

                      1 of 1 people found this helpful
                      • 10. Re: How to Receiving Rest Calls with Map type Object?
                        Antonio Giambanco Novice

                        Ok, I deployed jbpm-console, I like so much new features

                        • I have some problems with old instances still running but not visible now (I can see just task list)
                        • In the data modeler I don't find Map and List types
                        • I try to deploy demo processes and I don't see them in the deployed list
                        • 11. Re: How to Receiving Rest Calls with Map type Object?
                          Maciej Swiderski Master

                          you need to upgrade your data base, see this script for various dbs scripts.

                           

                          HTH

                          • 12. Re: How to Receiving Rest Calls with Map type Object?
                            Antonio Giambanco Novice

                            I did almost everything by deploying from Deploy a New Unit menuu' and now I update with that script

                            What about Map and List Type?

                            An other question:

                            When I launch a Rest request is possible to have a json response instead of a xml one?

                            • 13. Re: How to Receiving Rest Calls with Map type Object?
                              Maciej Swiderski Master

                              Antonio Giambanco wrote:

                               

                              I did almost everything by deploying from Deploy a New Unit menuu' and now I update with that script

                              What about Map and List Type?

                              if that does not work still please file jira for this

                               

                              Antonio Giambanco wrote:

                               

                              An other question:

                              When I launch a Rest request is possible to have a json response instead of a xml one?

                              yes, just set Accept header to application/json

                               

                              HTH

                              • 14. Re: How to Receiving Rest Calls with Map type Object?
                                Antonio Giambanco Novice

                                 

                                I take some testes and I will open an issue on jira.

                                I'm looking for the kie-services-client jar compatible with 6.2cr3 in the previous version I used runtime/kie-services-client-6.1.0.Final.jar (6.1.0 jar doen't work with 6.2)

                                Did something changend?

                                1 2 Previous Next