[jboss-jira] [JBoss JIRA] (DROOLS-2840) Java Controller Client Websocket API - Unmarshal result/input incorrect

Cristiano Nicolai (JIRA) issues at jboss.org
Mon Aug 6 21:39:00 EDT 2018


    [ https://issues.jboss.org/browse/DROOLS-2840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13615436#comment-13615436 ] 

Cristiano Nicolai commented on DROOLS-2840:
-------------------------------------------

[~doqtri] there is a sample project that I just updated to use version 7.9.0 that you can take a look as a reference, see: https://github.com/cristianonicolai/kie-server-controller-client-examples
If you can also send a stacktrace of the error, that would be helpful to identify the cause of this issue.
Regarding the annotations, that is not an issue as the JSON marshaller also inspects the JAXB annotations for serializing the content.

> Java Controller Client Websocket API - Unmarshal result/input incorrect
> -----------------------------------------------------------------------
>
>                 Key: DROOLS-2840
>                 URL: https://issues.jboss.org/browse/DROOLS-2840
>             Project: Drools
>          Issue Type: Bug
>          Components: kie server
>    Affects Versions: 7.9.0.Final
>            Reporter: Tri Doan Quang
>            Assignee: Cristiano Nicolai
>
> I deployed Kie workbench & Kie server at version 7.9.0.Final
> and I am going to set up client by using websocket API as provided here:
>    https://docs.jboss.org/drools/release/7.9.0.Final/drools-docs/html_single/index.html#_kie_server_controller_client_api
> {code:java}
> KieServerControllerClient client = KieServerControllerClientFactory.newWebSocketClient(URL_WS,
>                 USER,
>                 PASSWORD, new TestEventHandler());
>         final ServerTemplateList serverTemplateList = client.listServerTemplates();
>         System.out.println(String.format("Found %s server template(s) at controller url: %s",
>                     serverTemplateList.getServerTemplates().length,
>                     URL));
> {code}
> However, I got NPE since `serverTemplateList` is NULL.
> I dig to the code and observed:
> 1. Server responses in JSON format:
>     
> {code:java}
> '{
>   "type" : "SUCCESS",
>   "msg" : "",
>   "result" : {
>     "server-template-list" : {
>       "server-template" : [ {
>         "server-id" : "kie-server-v1",
>         "server-name" : "kie-server-v1",
>         "container-specs" : [ ],
>         "server-config" : { },
>         "server-instances" : [ {
>           "server-instance-id" : "kie-server-v1 at 192.168.1.6:8180",
>           "server-name" : "kie-server-v1 at 192.168.1.6:8180",
>           "server-template-id" : "kie-server-v1",
>           "server-url" : "http://192.168.1.6:8180/kie-server/services/rest/server"
>         } ],
>         "capabilities" : [ "RULE", "PROCESS", "PLANNING" ]
>       } ]
>     }
>   }
> }'
> {code}
> 2. But the decoder tries to unmarshall to the target object which is not defined well in JSON. It's defined in JAXB
>    
>    org.kie.server.controller.api.model.KieServerControllerServiceResponse
>   
> {code:java}
> @XmlAttribute
>     private ResponseType type;
>     @XmlAttribute
>     private String msg;
>     @XmlElements({
>             //Kie Server Controller model
>             @XmlElement(name = "server-template-list", type = ServerTemplateList.class),
>             @XmlElement(name = "server-template-details", type = ServerTemplate.class),
>             @XmlElement(name = "server-template-key-list", type = ServerTemplateKeyList.class),
>             @XmlElement(name = "server-template-key", type = ServerTemplateKey.class),
>             @XmlElement(name = "container-spec-list", type = ContainerSpecList.class),
>             @XmlElement(name = "container-spec-details", type = ContainerSpec.class),
>             @XmlElement(name = "server-instance-key-list", type = ServerInstanceKeyList.class),
>             @XmlElement(name = "server-instance-key", type = ServerInstanceKey.class),
>             @XmlElement(name = "container-details-list", type = ContainerList.class)
>     })
>     private T result;
> {code}
> Similar issues when I tried to register Event notification from Websocket (given in above link). All values are null.
> I am not sure I am missing some configuration. 
> Any one help me please? Many Thanks.
>    



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list