[jboss-jira] [JBoss JIRA] (DROOLS-1509) ServiceResponse XStream marshalling inconsistencies with JAXB

Matteo Mortari (JIRA) issues at jboss.org
Tue Apr 4 04:58:00 EDT 2017


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

Matteo Mortari edited comment on DROOLS-1509 at 4/4/17 4:57 AM:
----------------------------------------------------------------

Examples JAXB (baseline of reference, and unchanged):

{code:xml}
10:48:11.167 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:11.518 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:11.672 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server/containers'
10:48:11.677 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="List of created containers">
    <kie-containers/>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:43.307 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:43.313 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'

10:48:44.944 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Container two-dmn-models successfully deployed with module org.kie.server.testing:two-dmn-models:1.0.0.Final.">
    <kie-container container-id="two-dmn-models" status="STARTED">
        <release-id>
            <artifact-id>two-dmn-models</artifact-id>
            <group-id>org.kie.server.testing</group-id>
            <version>1.0.0.Final</version>
        </release-id>
        <resolved-release-id>
            <artifact-id>two-dmn-models</artifact-id>
            <group-id>org.kie.server.testing</group-id>
            <version>1.0.0.Final</version>
        </resolved-release-id>
        <scanner status="DISPOSED"/>
    </kie-container>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:44.999 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:45.004 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'

10:48:45.372 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="OK from container 'two-dmn-models'">
    <dmn-evaluation-result>
        <model-namespace>https://www.drools.org/kie-dmn/function-definition</model-namespace>
        <model-name>function-definition</model-name>
        <dmn-context xsi:type="jaxbListWrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <type>MAP</type>
            <element xsi:type="jaxbStringObjectPair" key="a">
                <value xsi:type="xs:int" xmlns:xs="http://www.w3.org/2001/XMLSchema">10</value>
            </element>
            <element xsi:type="jaxbStringObjectPair" key="b">
                <value xsi:type="xs:int" xmlns:xs="http://www.w3.org/2001/XMLSchema">5</value>
            </element>
            <element xsi:type="jaxbStringObjectPair" key="Math">
                <value xsi:type="jaxbListWrapper">
                    <type>MAP</type>
                    <element xsi:type="jaxbStringObjectPair" key="SumFunction">
                        <value xsi:type="dmnNodeStub">function Math( v1, v2 )</value>
                    </element>
                    <element xsi:type="jaxbStringObjectPair" key="Sum">
                        <value xsi:type="xs:decimal" xmlns:xs="http://www.w3.org/2001/XMLSchema">15</value>
                    </element>
                </value>
            </element>
        </dmn-context>
        <messages/>
        <decisionResults>
            <entry>
                <key>_b459d12a-f00f-4846-a12e-2883455f7d7b</key>
                <value>
                    <decision-id>_b459d12a-f00f-4846-a12e-2883455f7d7b</decision-id>
                    <decision-name>Math</decision-name>
                    <result xsi:type="jaxbListWrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <type>MAP</type>
                        <element xsi:type="jaxbStringObjectPair" key="SumFunction">
                            <value xsi:type="dmnNodeStub">function Math( v1, v2 )</value>
                        </element>
                        <element xsi:type="jaxbStringObjectPair" key="Sum">
                            <value xsi:type="xs:decimal" xmlns:xs="http://www.w3.org/2001/XMLSchema">15</value>
                        </element>
                    </result>
                    <status>SUCCEEDED</status>
                </value>
            </entry>
        </decisionResults>
    </dmn-evaluation-result>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:45.429 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:45.436 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'

10:48:45.541 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="OK from container 'two-dmn-models'">
    <dmn-evaluation-result>
        <model-namespace>https://github.com/kiegroup/kie-dmn/input-data-string</model-namespace>
        <model-name>input-data-string</model-name>
        <dmn-context xsi:type="jaxbListWrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <type>MAP</type>
            <element xsi:type="jaxbStringObjectPair" key="Full Name">
                <value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">John Doe</value>
            </element>
            <element xsi:type="jaxbStringObjectPair" key="Greeting Message">
                <value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">Hello John Doe</value>
            </element>
        </dmn-context>
        <messages/>
        <decisionResults>
            <entry>
                <key>d_GreetingMessage</key>
                <value>
                    <decision-id>d_GreetingMessage</decision-id>
                    <decision-name>Greeting Message</decision-name>
                    <result xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Hello John Doe</result>
                    <status>SUCCEEDED</status>
                </value>
            </entry>
        </decisionResults>
    </dmn-evaluation-result>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
{code}



was (Author: tari_manga):
Example JAXB (baseline of reference, and unchanged):

{code:xml}
10:48:11.167 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:11.518 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:11.672 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server/containers'
10:48:11.677 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="List of created containers">
    <kie-containers/>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:43.307 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:43.313 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'

10:48:44.944 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Container two-dmn-models successfully deployed with module org.kie.server.testing:two-dmn-models:1.0.0.Final.">
    <kie-container container-id="two-dmn-models" status="STARTED">
        <release-id>
            <artifact-id>two-dmn-models</artifact-id>
            <group-id>org.kie.server.testing</group-id>
            <version>1.0.0.Final</version>
        </release-id>
        <resolved-release-id>
            <artifact-id>two-dmn-models</artifact-id>
            <group-id>org.kie.server.testing</group-id>
            <version>1.0.0.Final</version>
        </resolved-release-id>
        <scanner status="DISPOSED"/>
    </kie-container>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:44.999 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:45.004 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'

10:48:45.372 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="OK from container 'two-dmn-models'">
    <dmn-evaluation-result>
        <model-namespace>https://www.drools.org/kie-dmn/function-definition</model-namespace>
        <model-name>function-definition</model-name>
        <dmn-context xsi:type="jaxbListWrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <type>MAP</type>
            <element xsi:type="jaxbStringObjectPair" key="a">
                <value xsi:type="xs:int" xmlns:xs="http://www.w3.org/2001/XMLSchema">10</value>
            </element>
            <element xsi:type="jaxbStringObjectPair" key="b">
                <value xsi:type="xs:int" xmlns:xs="http://www.w3.org/2001/XMLSchema">5</value>
            </element>
            <element xsi:type="jaxbStringObjectPair" key="Math">
                <value xsi:type="jaxbListWrapper">
                    <type>MAP</type>
                    <element xsi:type="jaxbStringObjectPair" key="SumFunction">
                        <value xsi:type="dmnNodeStub">function Math( v1, v2 )</value>
                    </element>
                    <element xsi:type="jaxbStringObjectPair" key="Sum">
                        <value xsi:type="xs:decimal" xmlns:xs="http://www.w3.org/2001/XMLSchema">15</value>
                    </element>
                </value>
            </element>
        </dmn-context>
        <messages/>
        <decisionResults>
            <entry>
                <key>_b459d12a-f00f-4846-a12e-2883455f7d7b</key>
                <value>
                    <decision-id>_b459d12a-f00f-4846-a12e-2883455f7d7b</decision-id>
                    <decision-name>Math</decision-name>
                    <result xsi:type="jaxbListWrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <type>MAP</type>
                        <element xsi:type="jaxbStringObjectPair" key="SumFunction">
                            <value xsi:type="dmnNodeStub">function Math( v1, v2 )</value>
                        </element>
                        <element xsi:type="jaxbStringObjectPair" key="Sum">
                            <value xsi:type="xs:decimal" xmlns:xs="http://www.w3.org/2001/XMLSchema">15</value>
                        </element>
                    </result>
                    <status>SUCCEEDED</status>
                </value>
            </entry>
        </decisionResults>
    </dmn-evaluation-result>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
10:48:45.429 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to send GET request to 'http://localhost:34455/kie-server-services/services/rest/server'
10:48:45.436 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Kie Server info">
    <kie-server-info>
        <capabilities>KieServer</capabilities>
        <capabilities>BRM</capabilities>
        <capabilities>DMN</capabilities>
        <location>http://localhost:8230/kie-server/services/rest/server</location>
        <messages>
            <content>Server KieServerInfo{serverId='a0e625bf-251d-3c1f-ad11-0a17f1c14e21', version='7.0.0-SNAPSHOT', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 04 10:48:07 CEST 2017</content>
            <severity>INFO</severity>
            <timestamp>2017-04-04T10:48:07.717+02:00</timestamp>
        </messages>
        <name>KieServer@/kie-server-services</name>
        <id>a0e625bf-251d-3c1f-ad11-0a17f1c14e21</id>
        <version>7.0.0-SNAPSHOT</version>
    </kie-server-info>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'

10:48:45.541 [main] DEBUG o.k.s.c.i.AbstractKieServicesClientImpl - About to deserialize content: 
 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="OK from container 'two-dmn-models'">
    <dmn-evaluation-result>
        <model-namespace>https://github.com/kiegroup/kie-dmn/input-data-string</model-namespace>
        <model-name>input-data-string</model-name>
        <dmn-context xsi:type="jaxbListWrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <type>MAP</type>
            <element xsi:type="jaxbStringObjectPair" key="Full Name">
                <value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">John Doe</value>
            </element>
            <element xsi:type="jaxbStringObjectPair" key="Greeting Message">
                <value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">Hello John Doe</value>
            </element>
        </dmn-context>
        <messages/>
        <decisionResults>
            <entry>
                <key>d_GreetingMessage</key>
                <value>
                    <decision-id>d_GreetingMessage</decision-id>
                    <decision-name>Greeting Message</decision-name>
                    <result xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Hello John Doe</result>
                    <status>SUCCEEDED</status>
                </value>
            </entry>
        </decisionResults>
    </dmn-evaluation-result>
</response>
' 
 into type: 'class org.kie.server.api.model.ServiceResponse'
{code}


> ServiceResponse XStream marshalling inconsistencies with JAXB
> -------------------------------------------------------------
>
>                 Key: DROOLS-1509
>                 URL: https://issues.jboss.org/browse/DROOLS-1509
>             Project: Drools
>          Issue Type: Bug
>          Components: kie server
>            Reporter: Matteo Mortari
>            Assignee: Matteo Mortari
>
> XML Element in XStream is rendered with canonical name instead of being consistent with JAXB, for "response".
> Additionally in JAXB marshalling the {{type}} and {{msg}} are attributes, while in XStream are child elements.
> Please notice String special character escape is handled differently JAXB Vs XStream and this is NOT subject of this bug.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list