New to Jackson - Problem with XML response - duplicated nodes with same names

14 views
Skip to first unread message

o haya

unread,
Nov 29, 2021, 7:05:15 PM11/29/21
to jackson-user
Hi,

I have just started working with a Spring boot project.  This currently works and supports JSON responses, and I am trying to add support for XML responses.  

Being new, it's been a struggle (that is an understatement :)!), but the last (two) problem(s) that I am encountering is that there are 2 situations where there are multiple levels with duplicated element names.  

The responses that I am working with are XACML 2.0 responses, and I think that they generated the model classes with XJC(?) and the XACML 2.0 XSD.  

The "expected" response message is (for example) supposed to look like:

<Response xmlns:ns2="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
          xmlns:ns3="urn:oasis:names:tc:xacml:2.0:context:schema:os">
      <ns3:Result ResourceId="xxxxxxxxxxxxxxxxxxxx">
         <ns3:Decision>Permit</ns3:Decision>
         <ns3:Status>
            <ns3:StatusCode value="urn:oasis:names:tc:xacml:1.0:status:ok"/>
         </ns3:Status>
         <ns2:Obligations>
            <ns2:Obligation FulfillOn="Permit"
                            ObligationId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#Roles">
               
                  <ns2:AttributeAssignment AttributeId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#role"
                                           DataType="http://www.w3.org/2001/XMLSchema#string">AuthenticatedUser</ns2:AttributeAssignment>
               
            </ns2:Obligation>
            <ns2:Obligation FulfillOn="Permit"
                            ObligationId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#ResponseAttributes">
              
                  <ns2:AttributeAssignment AttributeId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#decisionTime"
                                           DataType="http://www.w3.org/2001/XMLSchema#dateTime">2021-11-28T18:27:09.800Z</ns2:AttributeAssignment>
               
            </ns2:Obligation>
         </ns2:Obligations>
      </ns3:Result>
</Response>

But, the responses that I actually currently getting look like the following:

<Response xmlns:ns2="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
          xmlns:ns3="urn:oasis:names:tc:xacml:2.0:context:schema:os">
   <ns3:Result>
      <ns3:Result ResourceId=" xxxxxxxxxxxxxxxxxxxx  ">
         <ns3:Decision>Permit</ns3:Decision>
         <ns3:Status>
            <ns3:StatusCode value="urn:oasis:names:tc:xacml:1.0:status:ok"/>
         </ns3:Status>
         <ns2:Obligations>
            <ns2:Obligation FulfillOn="Permit"
                            ObligationId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#Roles">
               <ns2:AttributeAssignment>
                  <ns2:AttributeAssignment AttributeId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#role"
                                           DataType="http://www.w3.org/2001/XMLSchema#string">AuthenticatedUser</ns2:AttributeAssignment>
               </ns2:AttributeAssignment>
            </ns2:Obligation>
            <ns2:Obligation FulfillOn="Permit"
                            ObligationId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#ResponseAttributes">
               <ns2:AttributeAssignment>
                  <ns2:AttributeAssignment AttributeId="http://security.bea.com/ssmws/ssm-ws-1.0.wsdl#decisionTime"
                                           DataType="http://www.w3.org/2001/XMLSchema#dateTime">2021-11-28T18:27:09.800Z</ns2:AttributeAssignment>
               </ns2:AttributeAssignment>
            </ns2:Obligation>
         </ns2:Obligations>
      </ns3:Result>
   </ns3:Result>
</Response>

Notice that there are 2 levels with <ns3:Result> and also 2 levels with <ns2:AttributeAssignment>?

What kind of scenario might be causing that?

As I mentioned, I am really new to using Jackson, so please let me know what information might help to figure what the problem is?

Thanks,
Jim

Reply all
Reply to author
Forward
0 new messages