cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1304
Views
2
Helpful
5
Replies

addUser problem.

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>";

1 Accepted Solution

Accepted Solutions

Try without specifying the <userRoles> elements - you should only specify the userGroup name, I think.

View solution in original post

5 Replies 5

dstaudt
Cisco Employee
Cisco Employee

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>

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>

Try without specifying the <userRoles> elements - you should only specify the userGroup name, I think.

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?

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>";