addDeviceProfile requires Security Profile

Version 1
    This document was generated from CDN thread

    Created by: Geoffrey Carman on 15-02-2013 11:07:16 AM
    If I send this SOAP into CUCM 8,6.1, with a header soap-action="CUCMB ver=8.5 addDeviceProfile"
        <soapenv:Envelope xmlns:ns="http://www.cisco.com/AXL/API/8.5" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
          <soapenv:Header/>
          <soapenv:Body>
            <ns:addDeviceProfile sequence="?">
              <deviceProfile ctiid="?">
                <name>EM_Profile_70001</name>
                <product>Cisco 7960</product>
                <protocol>SCCP</protocol>
                <protocolSide>User</protocolSide>
                <userHoldMohAudioSourceId>1</userHoldMohAudioSourceId>
                <mlppIndicationStatus>Off</mlppIndicationStatus>
                <preemption>Default</preemption>
                <lines>
                  <line ctiid="?">
                    <ringSetting>Ring</ringSetting>
                    <consecutiveRingSetting>Use System Default</consecutiveRingSetting>
                    <mwlPolicy>Use System Policy</mwlPolicy>
                    <maxNumCalls>2</maxNumCalls>
                    <busyTrigger>1</busyTrigger>
                    <callInfoDisplay>
                      <callerName>true</callerName>
                      <callerNumber>false</callerNumber>
                      <redirectedNumber>false</redirectedNumber>
                      <dialedNumber>true</dialedNumber>
                    </callInfoDisplay>
                    <recordingFlag>Call Recording Disabled</recordingFlag>
                    <audibleMwi>Default</audibleMwi>
                    <partitionUsage>General</partitionUsage>
                    <missedCallLogging>true</missedCallLogging>
                  </line>
                  <line ctiid="?">
                    <index>1</index>
                    <label>Bobby Gavin Smith</label>
                    <asciiLabel>Bobby Gavin Smith</asciiLabel>
                    <display>Bobby Gavin Smith 12345</display>
                    <ringSetting>Ring</ringSetting>
                    <consecutiveRingSetting>Use System Default</consecutiveRingSetting>
                    <displayAscii>Bobby Gavin Smith 12345</displayAscii>
                    <mwlPolicy>Use System Policy</mwlPolicy>
                    <maxNumCalls>2</maxNumCalls>
                    <busyTrigger>1</busyTrigger>
                    <callInfoDisplay>
                      <callerName>true</callerName>
                      <callerNumber>false</callerNumber>
                      <redirectedNumber>false</redirectedNumber>
                      <dialedNumber>true</dialedNumber>
                    </callInfoDisplay>
                    <recordingFlag>Call Recording Disabled</recordingFlag>
                    <audibleMwi>Default</audibleMwi>
                    <partitionUsage>General</partitionUsage>
                    <missedCallLogging>true</missedCallLogging>
                  </line>
                </lines>
                <phoneTemplateName uuid="?">Standard 7960 SCCP 2 Line</phoneTemplateName>
                <addOnModules>
                  <addOnModule>
                    <model>7914 14-Button Line Expansion Module</model>
                  </addOnModule>
                </addOnModules>
                <singleButtonBarge>Default</singleButtonBarge>
                <joinAcrossLines>Default</joinAcrossLines>
                <ignorePresentationIndicators>false</ignorePresentationIndicators>
                <dndOption>Ringer Off</dndOption>
                <alwaysUsePrimeLine>Default</alwaysUsePrimeLine>
                <alwaysUsePrimeLineForVoiceMessage>Default</alwaysUsePrimeLineForVoiceMessage>
                <softkeyTemplateName uuid="?">Standard User</softkeyTemplateName>
                <callInfoPrivacyStatus>Default</callInfoPrivacyStatus>
                <services>
                  <service>
                    <urlButtonIndex>0</urlButtonIndex>
                  </service>
                </services>
              </deviceProfile>
            </ns:addDeviceProfile>
          </soapenv:Body>
        </soapenv:Envelope>
     
     
    I get returned:
     
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
          <soapenv:Body>
            <soapenv:Fault>
              <faultcode>soapenv:Client</faultcode>
              <faultstring>Security Profile is required for this device</faultstring>
              <detail>
                <axlError>
                  <axlcode>429</axlcode>
                  <axlmessage>Security Profile is required for this device</axlmessage>
                  <request>addDeviceProfile</request>
                </axlError>
              </detail>
            </soapenv:Fault>
          </soapenv:Body>
        </soapenv:Envelope>
     
    How would I set a Security Profile for this device?  I cannot figure out how to specify it.
    I feel like I am missing something obvious here.  Specifically I am trying to add a Mobility Profile, so maybe this is the wrong API call?  But assume I then wanted to assign a Device Profile (static?) how would I then still set the Security Profile?

    Subject: RE: addDeviceProfile requires Security Profile
    Replied by: Josh Gross on 22-02-2013 02:05:38 AM
    So I made your request work, but there were several changes i made to your AXL as well as with the header you said you used. The header should be SOAPAction="CUCMB ver=8.5"
     

    The AXL i used is as follows:
     
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
       <soapenv:Header/>
       <soapenv:Body>
            <ns:addDeviceProfile sequence="?">
              <deviceProfile ctiid="?">
                <name>EMProfile70001</name>
                <product>Cisco 7960</product>
                <protocol>SCCP</protocol>
                <class>Device Profile</class>
                <protocolSide>User</protocolSide>
                <userHoldMohAudioSourceId>1</userHoldMohAudioSourceId>
                <mlppIndicationStatus>Off</mlppIndicationStatus>
                <preemption>Default</preemption>
                <lines>
                 <lineIdentifier>
                      <directoryNumber>#1014</directoryNumber>
                      <routePartitionName>hudtloff-Speakers</routePartitionName>
                    <index>1</index>
                    <label>Bobby Gavin Smith</label>
                    <asciiLabel>Bobby Gavin Smith</asciiLabel>
                    <display>Bobby Gavin Smith 12345</display>
                    <ringSetting>Ring</ringSetting>
                    <consecutiveRingSetting>Use System Default</consecutiveRingSetting>
                    <displayAscii>Bobby Gavin Smith 12345</displayAscii>
                    <mwlPolicy>Use System Policy</mwlPolicy>
                    <maxNumCalls>2</maxNumCalls>
                    <busyTrigger>1</busyTrigger>
                    <callInfoDisplay>
                      <callerName>true</callerName>
                      <callerNumber>false</callerNumber>
                      <redirectedNumber>false</redirectedNumber>
                      <dialedNumber>true</dialedNumber>
                    </callInfoDisplay>
                    <recordingFlag>Call Recording Disabled</recordingFlag>
                    <audibleMwi>Default</audibleMwi>
                    <partitionUsage>General</partitionUsage>
                    <missedCallLogging>true</missedCallLogging>
                  </lineIdentifier>
                </lines>
                <phoneTemplateName uuid="?">Standard 7960 SCCP 2 Line</phoneTemplateName>
                <addOnModules>
                  <addOnModule>
                    <model>7914 14-Button Line Expansion Module</model>
                    <index>1</index>
                  </addOnModule>
                </addOnModules>
                <singleButtonBarge>Default</singleButtonBarge>
                <joinAcrossLines>Default</joinAcrossLines>
                <ignorePresentationIndicators>false</ignorePresentationIndicators>
                <dndOption>Ringer Off</dndOption>
                <alwaysUsePrimeLine>Default</alwaysUsePrimeLine>
                <alwaysUsePrimeLineForVoiceMessage>Default</alwaysUsePrimeLineForVoiceMessage>
                <softkeyTemplateName uuid="?">Standard User</softkeyTemplateName>
                <callInfoPrivacyStatus>Default</callInfoPrivacyStatus>
              </deviceProfile>
            </ns:addDeviceProfile>
          </soapenv:Body>
        </soapenv:Envelope>
     
     
    Every thing in red is something i changed. The biggest things are that one of the required fields is <class>Device Profile</class>. Your request did not have that in there.

    The next thing that i changed is in the <lines>. Notice that instead of using <lines><line> </line></lines> i use <lines><lineIdentifier>
    </lineIdentifier></lines>. You had several problems in the line section one being that your first instance of <line> blah blah </line> isnt formed at all correctly. the second instance of <line> blah blah</line> is closer but your missing <index> and <dirn>. Now i am no expert i have yet to have any luck adding any type of line to any type of device using the <lines><line><dirn>  </dirn></line></lines>. The only way i have had success is using <lines><lineIdentifier><directoryNumber>xxxx</directoryNumber><routePartitionName>xxxxx</routePartitionName>. Here is what you had to add lines:

    <lines>
    <line ctiid="?">
                    <ringSetting>Ring</ringSetting>
                    <consecutiveRingSetting>Use System Default</consecutiveRingSetting>
                    <mwlPolicy>Use System Policy</mwlPolicy>
                    <maxNumCalls>2</maxNumCalls>
                    <busyTrigger>1</busyTrigger>
                    <callInfoDisplay>
                      <callerName>true</callerName>
                      <callerNumber>false</callerNumber>
                      <redirectedNumber>false</redirectedNumber>
                      <dialedNumber>true</dialedNumber>
                    </callInfoDisplay>
                    <recordingFlag>Call Recording Disabled</recordingFlag>
                    <audibleMwi>Default</audibleMwi>
                    <partitionUsage>General</partitionUsage>
                    <missedCallLogging>true</missedCallLogging>
                  </line>
                  <line ctiid="?">
                    <index>1</index>
                    <label>Bobby Gavin Smith</label>
                    <asciiLabel>Bobby Gavin Smith</asciiLabel>
                    <display>Bobby Gavin Smith 12345</display>
                    <ringSetting>Ring</ringSetting>
                    <consecutiveRingSetting>Use System Default</consecutiveRingSetting>
                    <displayAscii>Bobby Gavin Smith 12345</displayAscii>
                    <mwlPolicy>Use System Policy</mwlPolicy>
                    <maxNumCalls>2</maxNumCalls>
                    <busyTrigger>1</busyTrigger>
                    <callInfoDisplay>
                      <callerName>true</callerName>
                      <callerNumber>false</callerNumber>
                      <redirectedNumber>false</redirectedNumber>
                      <dialedNumber>true</dialedNumber>
                    </callInfoDisplay>
                    <recordingFlag>Call Recording Disabled</recordingFlag>
                    <audibleMwi>Default</audibleMwi>
                    <partitionUsage>General</partitionUsage>
                    <missedCallLogging>true</missedCallLogging>
                  </line>
                </lines>

    here is the corrected version (obviously you will need to change the directoryNumber and routePartition)
       <lines>
                 <lineIdentifier>
                      <directoryNumber>#1014</directoryNumber>
                      <routePartitionName>hudtloff-Speakers</routePartitionName>
                    <index>1</index>
                    <label>Bobby Gavin Smith</label>
                    <asciiLabel>Bobby Gavin Smith</asciiLabel>
                    <display>Bobby Gavin Smith 12345</display>
                    <ringSetting>Ring</ringSetting>
                    <consecutiveRingSetting>Use System Default</consecutiveRingSetting>
                    <displayAscii>Bobby Gavin Smith 12345</displayAscii>
                    <mwlPolicy>Use System Policy</mwlPolicy>
                    <maxNumCalls>2</maxNumCalls>
                    <busyTrigger>1</busyTrigger>
                    <callInfoDisplay>
                      <callerName>true</callerName>
                      <callerNumber>false</callerNumber>
                      <redirectedNumber>false</redirectedNumber>
                      <dialedNumber>true</dialedNumber>
                    </callInfoDisplay>
                    <recordingFlag>Call Recording Disabled</recordingFlag>
                    <audibleMwi>Default</audibleMwi>
                    <partitionUsage>General</partitionUsage>
                    <missedCallLogging>true</missedCallLogging>
                  </lineIdentifier>
                </lines>
     
    Sorry if my response is to long winded. This is my first response to a question and I want to be clear in how i made it work. Its frustrating when someone responds with only corrected code and no explanation. One more thing, I am no expert so if my understanding of any of this is wrong i apologize, i just know how to make this stuff work from time to time.

    Subject: RE: addDeviceProfile requires Security Profile
    Replied by: Geoffrey Carman on 22-02-2013 06:42:06 AM
    Josh,
    Thanks!  That was exactly what I was looking for, what I missed!  So what values are valid for <class> ?  Device Profile, and what else? 
     
    This is the sort of info I find missing in the WSDL and API docs, the sort of reasonable values expected in any particular field.
    Also, my WSDL shows the lineIdentifier section as:
                                <lineIdentifier>
                                    <directoryNumber>?</directoryNumber>
                                    <routePartitionName>?</routePartitionName>
                                </lineIdentifier>

     You seem to have placed much of the <line> settings values into the <lineIdentifier> node.  Is that legal?
    Most importantly, have you found a good reference for what are allowed values in the various fields?
    I will test this minor tweak and let you know.  (I am going to try <class> first, then <lineIdentifier> to see if I can nail it all down more accurately).
     
     
     

    Subject: RE: addDeviceProfile requires Security Profile
    Replied by: David Staudt on 22-02-2013 10:27:39 AM
    The schema does list an enumeration of the possible values for <class>, e.g. drill down through the HTML doc version of the schema to the XClass simpleType:
            <xsd:enumeration value="Phone"/>
            <xsd:enumeration value="Gateway"/>
            <xsd:enumeration value="Conference Bridge"/>
            <xsd:enumeration value="Media Termination Point"/>
            <xsd:enumeration value="Route List"/>
            <xsd:enumeration value="Voice Mail"/>
            <xsd:enumeration value="CTI Route Point"/>
            <xsd:enumeration value="Music On Hold"/>
            <xsd:enumeration value="Simulation"/>
            <xsd:enumeration value="Pilot"/>
            <xsd:enumeration value="GateKeeper"/>
            <xsd:enumeration value="Add-on modules"/>
            <xsd:enumeration value="Hidden Phone"/>
            <xsd:enumeration value="Trunk"/>
            <xsd:enumeration value="Tone Announcement Player"/>
            <xsd:enumeration value="Remote Destination Profile"/>
            <xsd:enumeration value="EMCC Base Phone Template"/>
            <xsd:enumeration value="EMCC Base Phone"/>
            <xsd:enumeration value="Remote Destination Profile Template"/>
            <xsd:enumeration value="Gateway Template"/>
            <xsd:enumeration value="UDP Template"/>
            <xsd:enumeration value="Phone Template"/>
            <xsd:enumeration value="Device Profile"/>
            <xsd:enumeration value="Invalid"/>

    You can also get a 'live' dump of the <class> list from the UCM database, e.g.:

    select name from typeclass

    Reading the list from UCM actually has practical implications for the <product> field (select name from typeproduct), as it is possible to install new device types into UCM (with new, unique <product> values), and these of course won't be listed in the AXL schema that shipped with the base UCM.  Note that <product> can also accept xsd:string values in addition to its enum list - this helps work around the challenge of installable product types.

    Subject: RE: addDeviceProfile requires Security Profile
    Replied by: Josh Gross on 22-02-2013 01:39:16 PM
    You need to remove:
        <services>
          <service>
        <urlButtonIndex>0</urlButtonIndex>
          </service>
        </services>
    That is not formed correctly and I am assuming you dont mean to be adding a service any way. I forgot to mark that on my original post that I remved that.
     
    To add a DN with out creating a device you go to Call Routing -> Directory Number -> Add New
     

    Subject: RE: addDeviceProfile requires Security Profile
    Replied by: Geoffrey Carman on 22-02-2013 01:09:37 PM
    Ok, so using <lineIdentifier> not <line> notation, I send in:
    <soapenv:Envelope xmlns:ns="http://www.cisco.com/AXL/API/8.5" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
    <ns:addDeviceProfile sequence="?">
      <deviceProfile ctiid="?">
        <name>EM_Profile_70001</name>
        <product>Cisco 7960</product>
        <class>Device Profile</class>
        <protocol>SCCP</protocol>
        <protocolSide>User</protocolSide>
        <userHoldMohAudioSourceId>1</userHoldMohAudioSourceId>
        <mlppIndicationStatus>Off</mlppIndicationStatus>
        <preemption>Default</preemption>
        <lines>
          <lineIdentifier>
        <directoryNumber>70001</directoryNumber>
        <routePartitionName>PT Line 1</routePartitionName>
        <index>1</index>
        <label>Bobby Gavin Smith</label>
        <asciiLabel>Bobby Gavin Smith</asciiLabel>
        <display>Bobby Gavin Smith 12345</display>
        <ringSetting>Ring</ringSetting>
        <consecutiveRingSetting>Use System Default</consecutiveRingSetting>
        <displayAscii>Bobby Gavin Smith 12345</displayAscii>
        <maxNumCalls>2</maxNumCalls>
        <busyTrigger>1</busyTrigger>
        <callInfoDisplay>
          <callerName>true</callerName>
          <callerNumber>false</callerNumber>
          <redirectedNumber>false</redirectedNumber>
          <dialedNumber>true</dialedNumber>
        </callInfoDisplay>
        <recordingFlag>Call Recording Disabled</recordingFlag>
        <audibleMwi>Default</audibleMwi>
        <partitionUsage>General</partitionUsage>
        <missedCallLogging>true</missedCallLogging>
          </lineIdentifier>
        </lines>
        <phoneTemplateName uuid="?">Standard 7960 SCCP 2 Line</phoneTemplateName>
        <addOnModules>
          <addOnModule>
        <model>7914 14-Button Line Expansion Module</model>
        <index>1</index>
          </addOnModule>
        </addOnModules>
        <defaultProfileName uuid="?">Cisco 7960 - Standard SCCP Non-Secure Profile</defaultProfileName>
        <singleButtonBarge>Default</singleButtonBarge>
        <joinAcrossLines>Default</joinAcrossLines>
        <ignorePresentationIndicators>false</ignorePresentationIndicators>
        <dndOption>Ringer Off</dndOption>
        <alwaysUsePrimeLine>Default</alwaysUsePrimeLine>
        <alwaysUsePrimeLineForVoiceMessage>Default</alwaysUsePrimeLineForVoiceMessage>
        <softkeyTemplateName uuid="?">Standard User</softkeyTemplateName>
        <callInfoPrivacyStatus>Default</callInfoPrivacyStatus>
        <services>
          <service>
        <urlButtonIndex>0</urlButtonIndex>
          </service>
        </services>
      </deviceProfile>
    </ns:addDeviceProfile>
    </soapenv:Body>
    </soapenv:Envelope>


    My headers are:
    Authorization: <credentials suppressed>
    SOAPAction: CUCMB ver=8.5 addDeviceProfile
    Content-Type: text/xml; charset=utf-8


    I get back:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <soapenv:Fault>
      <faultcode>soapenv:Client</faultcode>
      <faultstring>Failure</faultstring>
      <detail>
        <axlError>
          <axlcode>-1</axlcode>
          <axlmessage>Failure</axlmessage>
          <request>addDeviceProfile</request>
        </axlError>
      </detail>
    </soapenv:Fault>
    </soapenv:Body>
    </soapenv:Envelope>


    This is not a helpful error.  The others at least left a hint, this one is sort of annoying. If I skip the <line> or <lineIdentifier> sections entirely I get a similar error. 
     
    I did a getLine to find my pattern of 70001 and I get nothing back,.  but if I listLine for 7000% I see my line there. 
     
    PS: How do I look at/create a raw Line by itself, not as part of an association to a device profile?  I am missing that in the GUI. 

    Subject: RE: addDeviceProfile requires Security Profile
    Replied by: Geoffrey Carman on 22-02-2013 01:48:18 PM
    Thanks!  That looks like it finally did it!  And thanks for the directory number hint.  The reason I had it left behind is the WSDL provides the sample SOAP call with ?'s in empty fields, and my code starts with the full event, you pop in data to the fields you want (based on input data) and then strip out whatever remains empty, and the urlButtonIndex value had the 0 left in the WSDL version, so just change that to ? and it gets stripped properly.  (If I decide we need to set more values, we just map more data into the SOAP call. )