cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
579
Views
0
Helpful
3
Replies

Route Point AXL

Sebastian74842
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

npetrele
Cisco Employee
Cisco Employee

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();
	}
}
  

 

View solution in original post

3 Replies 3

npetrele
Cisco Employee
Cisco Employee

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();
	}
}
  

 

I try to create a route point. how can I do it?
What parameters do I need?

This repo has several Java AXL samples, using (mostly) best practices: https://github.com/CiscoDevNet/axl-java-samples

See the "addCtiRoutePoint.java" sample.