08-10-2016 01:16 AM
Hi, all
I want to upgrade phone load name and apply config via Java client for AXL on CUCM11.5. As a new beginner, I ran the Demo script at https://developer.cisco.com/site/axl/learn/how-to/axl-java-sample-application.gsp first and I could get Product Name and Phone load info successfully. Then I looked through the java package under "com.cisco.axl.api._11", and I found method "setLoadInformation(JAXBElement<XLoadInformation> value)" in "UpdatePhoneReq.java", but I don't know how to use this method correctly... Looking forward to your help... Thanks!
Regards,
Jialing
Solved! Go to Solution.
08-11-2016 01:24 PM
After much trial-and-error and research I got the following to work against CUCM 11.0:
UpdatePhoneReq updatePhoneParams = new UpdatePhoneReq();
updatePhoneParams.setName(phoneName);
ObjectFactory factory = new ObjectFactory();
XLoadInformation loadInformationParam = factory.createXLoadInformation();
loadInformationParam.setValue("test-load-1");
JAXBElement<XLoadInformation> getPhoneLoadInformationParam = factory.createUpdatePhoneReqLoadInformation(loadInformationParam);
updatePhoneParams.setLoadInformation(getPhoneLoadInformationParam);
try {
StandardResponse updatePhoneResponse = axlPort.updatePhone(updatePhoneParams);
Demo.informUser("Load update succeeded" + "%n");
} catch ( Exception e) {
System.out.println("Error: " + e.getMessage() );
}
08-10-2016 08:55 AM
As this is more of a question about how to use JAX-WS generated classes (vs. a question about the AXL SOAP API itself), it may be helpful to look around for some JAX-WS tutorials or samples code on the web.
08-11-2016 02:26 AM
Hi, David
Do you have more specific materials of JAX-WS for CUCM to recommend? The JAX-WS tutorials on web are too general, and I just want to use the classes generated in this axl-demo https://developer.cisco.com/site/axl/learn/how-to/axl-java-sample-application.gsp. I'm studying the guides found on web but it's very time consuming, so I still hope someone could offer detailed methods to upgrade phones... Do you have any other suggestions? Thanks very much~
Best wishes.
Thanks,
Jialing
08-11-2016 01:24 PM
After much trial-and-error and research I got the following to work against CUCM 11.0:
UpdatePhoneReq updatePhoneParams = new UpdatePhoneReq();
updatePhoneParams.setName(phoneName);
ObjectFactory factory = new ObjectFactory();
XLoadInformation loadInformationParam = factory.createXLoadInformation();
loadInformationParam.setValue("test-load-1");
JAXBElement<XLoadInformation> getPhoneLoadInformationParam = factory.createUpdatePhoneReqLoadInformation(loadInformationParam);
updatePhoneParams.setLoadInformation(getPhoneLoadInformationParam);
try {
StandardResponse updatePhoneResponse = axlPort.updatePhone(updatePhoneParams);
Demo.informUser("Load update succeeded" + "%n");
} catch ( Exception e) {
System.out.println("Error: " + e.getMessage() );
}
08-11-2016 08:12 PM
You are so awesome, David~ I can update the phone load name with your code now.
After studying your code, I found that calling a function is much more complex than I expected, I think I should spend more time studying java since there are still a lot of difficult challenges lie ahead... Thank you so much for taking time to solve this problem~ Now I need to solve problems independently~ Any suggestions are welcomed. Wish me good luck.
Thanks,
Jialing
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