Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

correct way to use AXL API with complex types css, partition, etc. involving: JAXBElement<XFkType> ?

I am trying to figure out how to use the AXL API once exploded with the wsimport as explained here...
https://developer.cisco.com/site/collaboration/management/axl/learn/how-to/axl-java-sample-application.gsp

...to use complex types (partition, css, etc). 
--> What is the correct way to do it?

Example 1: UpdatePhone
--------
When incorporing a complex type into the addition or update of a component, for instance RoutePartitionName, DevicePoolName or CallingSearchSpaceName.
his function is not working:

public void actualizarPhone(LPhone lPhone) {
        try {
            UpdatePhoneReq axlParams = new UpdatePhoneReq();
            axlParams.setName(lPhone.getName());
            axlParams.setDescription(lPhone.getDescription());
            axlParams.setDevicePoolName(lPhone.getDevicePoolName());
            axlParams.setCallingSearchSpaceName(lPhone.getCallingSearchSpaceName());
            StandardResponse response = axlPort.updatePhone(axlParams);
            //return response.getReturn()a.toString();
        } catch (Exception e) {
            logger.error(e);
            //return new ArrayList<LPhone>();
        }
    }
It seems the right thing to do set as parameter for the "set" the result of the "get" in line: setDevicePoolName(lPhone.getDevicePoolName());
but it says: "The method setDevicePoolName(JAXBElement<XFkType>) in the type UpdatePhoneReq is not applicable for the arguments (XFkType)"

Example 2: AddLine
----------
I also have this problem when adding line. 
And I've tried at least 3 approaches, no success yet:

1)** Using factory object to obtain an R object

ObjectFactory factory = new ObjectFactory();
RRoutePartition rRoutePartition = factory.createRRoutePartition();
rRoutePartition.setName("autodial");

2) ** Trying to create the demanded object: JAXBElement<XFkType> myself.

JAXBElement<XFkType> jaxbElement= new JAXBElement<XFkType>(new QName ("http://www.cisco.com/AXL/API/8.5","XRoutePartition"),XFkType.class,partition);
jaxbElement.setValue(partition3);
line.setRoutePartitionName(jaxbElement);

3)** Using X Objects

XCallForwardBusy fwdBusy = new XCallForwardBusy();
fwdBusy.setForwardToVoiceMail("true");
AddLineReq newLine = new AddLineReq();
XLine line = new XLine();
line.setAlertingName("ALerting Name");
line.setAsciiAlertingName("Alerting Name ASCII");
line.setCallForwardBusy(fwdBusy);
line.setDescription("Description");
line.setPattern("5555");


I would appreciate a clean example about how to add a line setting a partition, and an explanation about how to use JAXBElement<XFkType> objects.

regards!

Everyone's tags (1)
175
Views
0
Helpful
0
Replies
CreatePlease to create content