Topic
  • 1 reply
  • Latest Post - ‏2019-04-22T15:20:48Z by kp.vista
Miroslav Mandic
Miroslav Mandic
2 Posts

Pinned topic Sending WSPerson object to WSExtensionService

‏2015-09-29T12:49:16Z | 6 isim wsextensionservice wsperson

Hi all,

 

In environment with ISIM6 fp8 and custom fronted java portal, I need to send WSPerson object from java portal to ISIM WSExtensionService. 

Problem is that com.ibm.itim.ws.client.util.xml.XMLBeanWriter doesn't serialize WSPerson object correctly to XML. 

Previously in WebServiceWrapper for ITIM 5.1 this worked correctly because attributes were an array of WSAttributes, and now in ISIM 6 attributes are in class ArrayOfTns1WSAttribute (which contains a List of WSAttribute). 

It doesn't meter if I manually populate the WSPerson object or get it as response from another service, when I parse it with XMLBeanWriter.writeXMLBean I get result as in the attached file (without attributes).

 I can transfer attributes in HashMap, or try to write custom serializer to use with XMLBeanWriter.writeXMLBeanCustom, but I guess somebody encountered with this already and has a better idea, or got this somehow working?

 

Best regards,

Miroslav

 

Attachments

  • kp.vista
    kp.vista
    12 Posts

    Re: Sending WSPerson object to WSExtensionService

    ‏2019-04-22T15:20:48Z  

    com.ibm.isim.personsvc.WSAttribute wsAttr = new com.ibm.isim.personsvc.WSAttribute();

                wsAttr.setName("uid");
                wsAttr.setOperation(1);
                ArrayOfXsdString arrStringValues = new ArrayOfXsdString();
                arrStringValues.getItem().add(person.getUid());

                // values
                //{"Blue-1022"};
                wsAttr.setValues(arrStringValues);

                attrList.add(wsAttr);
    // Populate the mandatory cn and sn attributes 
                arrStringValues = new ArrayOfXsdString();
                arrStringValues.getItem().add(person.getCn());
                wsAttr = new WSAttribute();
                wsAttr.setName("cn");
                wsAttr.setOperation(1);
                wsAttr.setValues(arrStringValues);
                attrList.add(wsAttr);

                arrStringValues = new ArrayOfXsdString();
                arrStringValues.getItem().add(person.getSn());
                wsAttr = new WSAttribute();
                wsAttr.setName("sn");
                wsAttr.setOperation(1);
                wsAttr.setValues(arrStringValues);
                attrList.add(wsAttr);

                if (person.getAdditionalInfo() != null && !person.getAdditionalInfo().isEmpty()) {
                    
                   for (Map.Entry<String, String> entry : person.getAdditionalInfo().entrySet()) {
                        System.out.println(entry.getKey() + " : " + entry.getValue());
    arrStringValues = new ArrayOfXsdString();
                        arrStringValues.getItem().add(entry.getValue());
                        wsAttr = new WSAttribute();
                        wsAttr.setName(entry.getKey());
                        wsAttr.setOperation(1);
                        wsAttr.setValues(arrStringValues);
                        attrList.add(wsAttr);
                    }
                }

    // Add any more attrs to the Collection attrList, and set attributes on person object. 
                com.ibm.isim.personsvc.WSAttribute[] wsAttrs = (com.ibm.isim.personsvc.WSAttribute[]) attrList.toArray(new WSAttribute[attrList.size()]);

                ArrayOfTns1WSAttribute tns = new ArrayOfTns1WSAttribute();
                tns.getItem().addAll(attrList);
                System.out.println(tns.getItem().size());
                wsPerson.setAttributes(tns);