06-07-2013 02:53 PM - edited 03-19-2019 06:50 AM
Hi guys,
I am trying to add a DN to an existing phone device using AXL API via Java. I keep getting this error:
Devices can only be associated with DNs, Route Patterns and Hunt Pilots.
I have two existing lines on this device which I added through call manager, but now I am trying to add a third one using AXL API. This is what I did to get this error and I am not sure why:
XDirn dn = new XDirn();
dn.setPattern("6340");
XPhoneLine phoneLine = new XPhoneLine();
phoneLine.setDirn(dn);
phoneLine.setAsciiLabel("TESTING - 6340");
phoneLine.setDisplay("TESTING - 6340");
phoneLine.setDisplayAscii("TESTING - 6340");
phoneLine.setLabel("TESTING - 6340");
phoneLine.setBusyTrigger("2");
phoneLine.setIndex("3");
phoneLine.setMaxNumCalls("4");
UpdatePhoneReq updatePhone = new UpdatePhoneReq();
updatePhone.setName("SEPD824BDBBCAF1");
UpdatePhoneReq.Lines newLine = new UpdatePhoneReq.Lines();
newLine.getLine().add(phoneLine);
updatePhone.setLines(newLine);
port.updatePhone(updatePhone);
the error occurs at the last line when I try to push the update.
Thanks
06-08-2013 10:09 AM
It would be better to post API question on the appropriate forums of developers.cisco.com
06-08-2013 11:22 AM
Also, can you paste the exception to here.
G.
06-08-2013 11:33 AM
I managed to get rid of the exception by taking out this line
newLine.getLine().add(phoneLine);
but I also told it that I want to add at index "3" and it just deleted my first two lines and it did not add anything!
What's the difference between RPhone and XPhone?
06-08-2013 11:48 AM
Check the phone button template. How many lines do you see there.
G.
06-10-2013 06:42 AM
There are many in there since I am working on a test alb that is backed up from the real thing.
I might just do it the hard way by sending the database sql commands and studying the data dictionary.
I can't beleive this API's poor documentation!
06-10-2013 07:16 AM
Hi,
please don't use SQL there. AXL was created to hide the internals of the CUCM. Just imagine, what if Cisco changes the database tables. Or they add a constraint so you actually update something in one table but you don't do it in another. AXL gives you a configuration layer regardless of the underlying tables so you shoud stick to using it.
G.
06-10-2013 07:26 AM
I agree with you, but I can't spend more time trying to get the API to work. I am basically guessing what I need to call and I keep debugging everything to see what kind of information is returned.
I hope somebody from cisco's staff sees this and start working on a proper documentation.
06-10-2013 08:54 AM
I just tried to execute SQL commands through the API and that is not working well either. The Axlsoaptoolkit.java file works fine but not through the API. this what I have done:
ExecuteSQLQueryReq sqlReq = new ExecuteSQLQueryReq();
sqlReq.setSql("select * from device");
ExecuteSQLQueryRes sqlRes = port.executeSQLQuery(sqlReq);
System.out.println(sqlRes.getReturn().getRow().get(0));
System.out.println(sqlRes.getReturn().getRow().get(1));
System.out.println(sqlRes.getReturn().getRow().get(2));
This returns null on the first 3 rows where I have more than a 1500 entries in that table. I verified using the Axlsoaptoolkit.java app
06-10-2013 02:22 PM
Hi,
can you tell me the exact CUCM version you are trying to work with.
I want to prove you that AXL is not complicated, in fact, can be fun.
G.
06-10-2013 02:35 PM
I am hoping that you would.
I am using 9.1
06-11-2013 01:59 AM
Hi,
oh, I see. I don't have that version yet, but I asked my Cisco contact. By the end of the week, I will have it.
In the meantime, I will try what I have (most likely 7.0, 8.0 or 8.5).
G.
06-11-2013 06:38 AM
Sounds good, I started building my application top-to-bottom, if you can figure it out I will use the API otherwise I'll just do it using the database.
What I posted above have not been changed between 8.5 and 9.1.
btw what is the difference betwen Xphone and RPhone?
06-11-2013 06:58 AM
Alright.
Please, double check the phone button template of the phone you are working on. Adding a third line on a phone with no third line is a no-no.
The difference between XPhone and RPhone:
http://developer.cisco.com/axl/Files/AXLSoap_XPhone.html#LinkE5F
http://developer.cisco.com/axl/Files/AXLSoap_RPhone.html#LinkB80
Looks like they are both the representation of a phone, but each element is used by a different method (the methods are listed there).
G.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide