09-21-2015 07:53 PM
Hello i got a problem when i tried a soap codes for addUser.
but got this error
"Error sending/receiving from server: Server returned HTTP response code: 500 for URL: https://192.168.10.11:8443/axl/"
i use cucm 9.1
here's the codes
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
URL url = new URL("https://192.168.10.11: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 = "operator" + ":" + "operator";
authorization = new sun.misc.BASE64Encoder().encode(authorization.getBytes());
conn.setRequestProperty("Authorization","Basic " + authorization);
//Set the SOAPAction header to 'CUCM:DB ver=8.5' for use with a UCM 8.5(1) host, request is 'getPhone'
conn.setRequestProperty("SOAPAction","CUCM:DB ver=9.1 ");
//The request body will be in XML format
conn.setRequestProperty("Content-Type","text/xml;charset=UTF-8");
String AXLRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/9.1\">";
AXLRequest += "<soapenv:Header/>";
AXLRequest += "<soapenv:Body>";
AXLRequest += "<ns:adduser sequence=\"?\">";
AXLRequest += "<user>";
AXLRequest += "<firstname>useer09</firstname>";
AXLRequest += "<lastname>Sample</lastname>";
AXLRequest += "<userid>jonesss</userid>";
AXLRequest += "<password>1234</password>";
AXLRequest += "<pin>1234</pin>";
AXLRequest += "<mailid>jsample@company.com</mailid>";
AXLRequest += "<department>Marketing</department>";
AXLRequest += "<manager>Jane Doe</manager>";
AXLRequest += "<associatedDevices>";
AXLRequest += "<name>SEP000000000006</name>";
AXLRequest += "</associateddevices>";
AXLRequest += "<primaryextension>";
AXLRequest += "<pattern>1010</pattern>";
AXLRequest += "</primaryextension>";
AXLRequest += "</user>";
AXLRequest += "</ns:adduser>";
AXLRequest += "</soapenv:Body>";
AXLRequest += "</soapenv:Envelope>";
Solved! Go to Solution.
09-25-2015 07:39 AM
Try without specifying the <userRoles> elements - you should only specify the userGroup name, I think.
09-23-2015 08:59 AM
There are several places where the case of the XML elements is not quite right, e.g. 'adduser', 'associateddevices', 'lastname', 'firstname'. Please ensure these are correct per the schema. The below XML worked for me on a test system:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/9.1">
<soapenv:Header/>
<soapenv:Body>
<ns:addUser sequence="?">
<user>
<firstName>useer09</firstName>
<lastName>Sample</lastName>
<userid>jonesss</userid>
<password>1234</password>
<pin>1234</pin>
<mailid>jsample@company.com</mailid>
<department>Marketing</department>
<manager>Jane Doe</manager>
<associatedDevices>
<name>SEP000000000006</name>
</associatedDevices>
<primaryExtension>
<pattern>1010</pattern>
</primaryExtension>
</user>
</ns:addUser>
</soapenv:Body>
</soapenv:Envelope>
09-24-2015 11:40 PM
Hello Mr. dstaudt
i already success try this codes
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/9.1">
<soapenv:Header/>
<soapenv:Body>
<ns:addUser sequence="?">
<user>
<firstName>Johhoney</firstName>
<lastName>Bishewoop</lastName>
<userid>qwey</userid>
<password>bishop</password>
<enableCti>true</enableCti>";
<enableMobility>true</enableMobility>
<imAndPresenceEnable>true</imAndPresenceEnable>
</user>
</ns:addUser>
</soapenv:Body>
</soapenv:Envelope>
but when i added "associatedGroup". it's showing error.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/9.1">
<soapenv:Header/>
<soapenv:Body>
<ns:addUser sequence="?">
<user>
<firstName>Johhoney</firstName>
<lastName>Bishewoop</lastName>
<userid>qwey</userid>
<password>bishop</password>
<enableCti>true</enableCti>";
<enableMobility>true</enableMobility>
<imAndPresenceEnable>true</imAndPresenceEnable>
<associatedGroups>
<userGroup>
<name>Standard CCM End Users</name> <userRoles> <userRole>Standard CCM End Users</userRole></userRoles>
</userGroup>
<userGroup>
<name>Standard CTI Enabled</name> <userRoles> <userRole>Standard CTI Enabled</userRole></userRoles>
</userGroup>
<userGroup>
<userRoles> <userRole>Standard CCMUSER Administration</userRole></userRoles>
</userGroup>
</associatedGroups>
</user>
</ns:addUser>
</soapenv:Body>
</soapenv:Envelope>
09-25-2015 07:39 AM
Try without specifying the <userRoles> elements - you should only specify the userGroup name, I think.
09-26-2015 08:31 AM
i tried this codes
<associatedGroups>
<userGroup>
<name>Standard CCM End Users</name> <userRole>Standard CCM End Users</userRole>
</userGroup>
<userGroup>
<name>Standard CTI Enabled</name> <userRole>Standard CTI Enabled</userRole>
</userGroup>
<userGroup>
<name>Standard CCMUSER Administration</name> <userRole>Standard CCMUSER Administration</userRole>
</userGroup>
</associatedGroups>
but it's still error. can you help me how to fix it?
09-27-2015 05:27 PM
finally i got the correct codes
AXLRequest += " <associatedGroups>";
AXLRequest += " <userGroup>";
AXLRequest += " <name>Standard CCM End Users</name> <userRole>Standard CCM End Users</userRole>";
AXLRequest += " </userGroup>";
AXLRequest += " <userGroup>";
AXLRequest += " <name>Standard CTI Enabled</name> <userRole>Standard CTI Enabled</userRole>";
AXLRequest += " </userGroup>";
AXLRequest += " </associatedGroups>";
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