cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1786
Views
0
Helpful
2
Replies

JAXBElement<XFkType> - Java development

schmetzgilles
Level 1
Level 1

Hi,

I'm develop an Web Application to build IPTEL site on Cisco Call Mangager in Java.

I've a little problem, and yes, I've already search and try solutions by myself 

So, I'm using the Cisco AXL api 9, and when I want to create an device pool, I need to set the devices pool's property called "LocationName".

The "setLocationName" method requires  'JAXBElement<XFkType> value' that I built before.

The problem is that when I check on my CallManager, nothing is set!


I can set the parameters with XFkType, String, Integer,... but really can't with an JAXBElement<>.


Could you give me an example? A Solution? I can make some test all day long.. I'm developping in NetBeans 7.4. Java. jdk 1.7.


Here is a piece of code to show you the way I try to set my device pool:


// Device Pool

        myDevicePool.setName("DP-" + cc + "-" + sn + "-" + sc);

        //Vérifier l'existance du TZG sinon créer pour le pays.

        XFkType dateTimeGroup = new XFkType();

        dateTimeGroup.setValue("TZG-BEL");

        XFkType CMGroupName = new XFkType();

        CMGroupName.setValue("Default");

        XFkType regionName = new XFkType();

        regionName.setValue(myRegion.getName());

       

        XFkType mrListName = new XFkType();

        mrListName.setValue(myMrgl.getName());

        JAXBElement<XFkType> mrlName = new JAXBElement(new QName(XFkType.class.getSimpleName()), XFkType.class, mrListName);

        mrlName.setValue(mrListName);

         

        XFkType locationName = new XFkType();

        locationName.setValue(myLocation.getName());

        JAXBElement<XFkType> jaxLocationName = new JAXBElement(new QName(XFkType.class.getSimpleName()), XFkType.class, locationName);

        jaxLocationName.setValue(locationName);

       

       

        //String networkLocale = getCountry();

        //JAXBElement<String> netLocal = new JAXBElement(new QName(String.class.getSimpleName()), String.class, networkLocale);

        //netLocal.setValue(networkLocale);

       

        if(Gateway)

        {

            if(nameSrst.isEmpty() || nameSrst.equals("NONE"))

            {

            } else {

                XFkType SrstName = new XFkType();

                SrstName.setValue(mySrst.getName());

                myDevicePool.setSrstName(SrstName);

            }

        }

       

        myDevicePool.setDateTimeSettingName(dateTimeGroup);

        myDevicePool.setCallManagerGroupName(CMGroupName);

        myDevicePool.setRegionName(regionName);

        myDevicePool.setMediaResourceListName(mrlName);

        try {

            myDevicePool.setLocationName(jaxLocationName);

        } catch (Exception e) {

            System.out.println(""+e.getMessage());

            e.printStackTrace();

        }

       

        //myDevicePool.setNetworkLocale(netLocal);

       

Thank you for your help,

Gilles.

PS: Please don't hesitate to ask for more information. And don't pay attention to my English, that's clearly not my native language

2 Replies 2

Geevarghese Cheria
Cisco Employee
Cisco Employee

Hi Gilles,

I would request you to refer the following url - https://developer.cisco.com/site/collaboration/management/axl/learn/how-to/axl-java-sample-application.gsp for related information.

Thanks and Regards,

Geevarghese

Hello, I was solving the same problem and there is my finding (and solution):

My example - I needed to change ownerUserID at device:


Java code at the beginning:

UpdatePhoneReq phReq = new UpdatePhoneReq();

phReq.setUuid(device_uuid);

XFkType user = new XFkType(); 

user.setUuid(getUserUUID(username));  //returns UserUUID

JAXBElement<XFkType> user2 = new JAXBElement(new QName(XFkType.class.getSimpleName()), XFkType.class, user);

phReq.setOwnerUserName(user2);

Final AXL message (downloaded as AXL log through RTMT):

<?xml version="1.0" ?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body>

<ns2:updatePhone xmlns:ns2="http://www.cisco.com/AXL/API/9.1">

<uuid>63af67a5-9d17-b0b7-7f67-8c4367ad5fd6</uuid>

<XFkType uuid="4d906690-51e4-0c0e-4d6d-70c28599a28c"/>

</ns2:updatePhone></S:Body> </S:Envelope>

- there is no mention about what I want to change (looking into java class UpdatePhoneReq, there is an AXL example at the beginning and I've found that I need to set-up ownerUserName property)


When I've added into my java code:

user.setValue(username);

AXL message contained:

<ns2:updatePhone xmlns:ns2="http://www.cisco.com/AXL/API/9.1">

<uuid>63af67a5-9d17-b0b7-7f67-8c4367ad5fd6</uuid>

<XFkType uuid="4d906690-51e4-0c0e-4d6d-70c28599a28c">test01</XFkType>

- so still the same



Solution is in:

user.setValue(username);

  JAXBElement<XFkType> user2 =

new JAXBElement(new QName("ownerUserName"), XFkType.class, user)

;

AXL message contained:

<ns2:updatePhone xmlns:ns2="http://www.cisco.com/AXL/API/9.1">

<uuid>63af67a5-9d17-b0b7-7f67-8c4367ad5fd6</uuid>

<ownerUserName>test01</ownerUserName>


and this is working.


You can use it with UUID (probably without Value property):

user.setUuid(getUserUUID(username));

AXL message contained:

<ownerUserName uuid="4d906690-51e4-0c0e-4d6d-70c28599a28c"/>



That is all


Good luck


Frantisek Marousek

CCIE Voice #42260