01-25-2021 06:41 AM
Hello
I need help.
Since I can create a route point with AXL and java, I am using "Java / JAX-WS Quickstart".
or have another idea how to perform this action if you can help me.
Thank you
Solved! Go to Solution.
01-25-2021 10:26 AM - edited 01-25-2021 10:28 AM
You can simply send XML requests to do what you want. Here's a simple sample (below).
package com.yourcompany.yoursystem.sample; import java.io.*; import java.net.*; public class GetPhoneSample { public static void main(String[] args) throws Exception { // AXL service URL on UC Manager host ds-ucm911.cisco.com // Note this sample assumes the certificate for the host with subject // name 'host.com' has been imported into the Java keystore URL url = new URL("https://host.com:8443/axl/"); // Create a java.net URLConnection object to make the HTTP request URLConnection conn = url.openConnection(); // setDoOutput=true causes the URLConnection to perform a POST operation conn.setDoOutput(true); // HTTP Basic authorization string - a base64 encoded string with // username:password, in this case 'Administrator:cisco!123' // This should be a UCM application user with Standard CCM Admin User // and Standard AXL API Access roles String authorization = "QWRtaW5pc3RyYXRvcjpjaXNjbyExMjM="; conn.setRequestProperty("Authorization", "Basic " + authorization); // Set the SOAPAction header to 'CUCM:DB ver=9.1' for use with a UCM // Request is 'getPhone' conn.setRequestProperty("SOAPAction", "\"CUCM:DB ver=9.1 getPhone\""); // The request body will be in XML format conn.setRequestProperty("Content-Type", "text/xml"); // Build a string containing the contents of the AXL XML request - here // 'getPhone' String AXLRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/9.1\">"; AXLRequest += "<soapenv:Body><ns:getPhone><name>SEP001B0CDBBE33</name></ns:getPhone></SOAP-ENV:Envelope>"; // Create an OutputStreamWriter for the URLConnection object and make // the request OutputStreamWriter writer = new OutputStreamWriter( conn.getOutputStream()); writer.write(AXLRequest); writer.flush(); // Read the response BufferedReader reader = new BufferedReader(new InputStreamReader( conn.getInputStream())); // Output the response to the console String line; while ((line = reader.readLine()) != null) { System.out.println(line); } // Cleanup the stream objects writer.close(); reader.close(); } }
01-25-2021 10:26 AM - edited 01-25-2021 10:28 AM
You can simply send XML requests to do what you want. Here's a simple sample (below).
package com.yourcompany.yoursystem.sample; import java.io.*; import java.net.*; public class GetPhoneSample { public static void main(String[] args) throws Exception { // AXL service URL on UC Manager host ds-ucm911.cisco.com // Note this sample assumes the certificate for the host with subject // name 'host.com' has been imported into the Java keystore URL url = new URL("https://host.com:8443/axl/"); // Create a java.net URLConnection object to make the HTTP request URLConnection conn = url.openConnection(); // setDoOutput=true causes the URLConnection to perform a POST operation conn.setDoOutput(true); // HTTP Basic authorization string - a base64 encoded string with // username:password, in this case 'Administrator:cisco!123' // This should be a UCM application user with Standard CCM Admin User // and Standard AXL API Access roles String authorization = "QWRtaW5pc3RyYXRvcjpjaXNjbyExMjM="; conn.setRequestProperty("Authorization", "Basic " + authorization); // Set the SOAPAction header to 'CUCM:DB ver=9.1' for use with a UCM // Request is 'getPhone' conn.setRequestProperty("SOAPAction", "\"CUCM:DB ver=9.1 getPhone\""); // The request body will be in XML format conn.setRequestProperty("Content-Type", "text/xml"); // Build a string containing the contents of the AXL XML request - here // 'getPhone' String AXLRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/9.1\">"; AXLRequest += "<soapenv:Body><ns:getPhone><name>SEP001B0CDBBE33</name></ns:getPhone></SOAP-ENV:Envelope>"; // Create an OutputStreamWriter for the URLConnection object and make // the request OutputStreamWriter writer = new OutputStreamWriter( conn.getOutputStream()); writer.write(AXLRequest); writer.flush(); // Read the response BufferedReader reader = new BufferedReader(new InputStreamReader( conn.getInputStream())); // Output the response to the console String line; while ((line = reader.readLine()) != null) { System.out.println(line); } // Cleanup the stream objects writer.close(); reader.close(); } }
01-25-2021 01:07 PM
I try to create a route point. how can I do it?
What parameters do I need?
01-25-2021 02:09 PM
This repo has several Java AXL samples, using (mostly) best practices: https://github.com/CiscoDevNet/axl-java-samples
See the "addCtiRoutePoint.java" sample.
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