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

Cisco IMC 3.0 XML API

Not applicable

Hello,

I am having difficulty accessing the XML API using the same methods previously employed to access CIMC 2.0,1.5, and 1.4

I do see there is a new RedFish API, but there is also still the option to enable XMLAPI from the Admin section and I still see documentation referencing version 3.0 in the documentation section which makes me believe it is still available.

I found some software updates for Windows 7 and registry changes to make sure that TLS 1.2 is enabled and usable.

This is the error I am getting using PowerShell

Exception calling "GetResponse" with "0" argument(s): "The underlying connection was closed: An unexpected error occurred on a send."
At C:\Users\beachw\Documents\Programming\Scripts\02. Development\CRG_5.1.10.0\Bin\Modules\UCS_XMLAPI.psm1:20 char:5
+ $response = $request.GetResponse()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException

You cannot call a method on a null-valued expression.
At C:\Users\beachw\Documents\Programming\Scripts\02. Development\CRG_5.1.10.0\Bin\Modules\UCS_XMLAPI.psm1:21 char:5
+ $sr = new-object System.IO.StreamReader($response.GetResponseStre ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\beachw\Documents\Programming\Scripts\02. Development\CRG_5.1.10.0\Bin\Modules\UCS_XMLAPI.psm1:22 char:5
+ $xml = [xml] $sr.ReadToEnd()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Postman does the same thing where it gets 0 response.

I have verified that the XML API is enabled

The visore page is accessible

3 Replies 3

Mastin Bailey
Cisco Employee
Cisco Employee

Hi Walter, thanks for your question!

Fair warning, I'm not an expert at troubleshooting these types of scripts, but I'll certainly do my best to help.  Worst case scenario is engaging our DevNet team directly, and those folks are great at this stuff.  Here's their website just in case.

Do you have a copy of the PS script and registry changes you made for TLS?  I can test it in the lab here.  What kind of information are you attempting to gather with it?  

Just to confirm, your script and registry changes work on 1.4, 1.5, and 2.0, but there's a failure on 3.0 correct?  What model server and 3.0 version are you running this against?  If this is a C-Series server, is it integrated with a UCS Domain?

Best,

Mastin

Hello,

Thank you for taking the time to reply.   I am working with another team and they will engage Cisco this morning.

To answer your questions.

  • The script works with 1.4, 1.5, and 2.0, and no registry changes were required.  For 3.0 the script no longer works, and postman no longer works, but visore.html does work.
  • Model is UCS C220 M4S
  • Version is 3.0(3a)
  • It is not integrated with a UCS Domain
  • Not sure if the TLS fix was required, but here is the link.  https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-a-default-secure-protocols-in

Script:

function ucsPost($url,$data) {
if ($script:nossl){
$u = "http://"+ $url +"/nuova"
}
else {
$u = "https://"+ $url +"/nuova"
}
$request = [System.Net.HttpWebRequest] [System.Net.HttpWebRequest]::Create($u)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$request.Method = "POST"
$request.ContentType = "text/xml"
$sendData = new-object System.IO.StreamWriter($request.GetRequestStream())
$sendData.Write($data)
$sendData.Close()
$response = $request.GetResponse()
$sr = new-object System.IO.StreamReader($response.GetResponseStream())
$xml = [xml] $sr.ReadToEnd()
return $xml
}

function ucsLogin($url, $inName, $inPassword) {
Write-Host "Logging into UCSM at " $url
$aaaLogin = "<aaaLogin inName='" + $inName + "' inPassword='" + $inPassword + "' />"
$xml = ucsPost $url $aaaLogin
$outCookie = $xml.aaaLogin.outCookie
return $outCookie
}

function ucsLogout($url, $inCookie) {
$aaaLogout = "<aaaLogout inCookie='" + $inCookie + "' />"
$xml = ucsPost $url $aaaLogout
$outStatus = $xml.aaaLogout.outStatus
return $outStatus
}

Use the functions to try to access the UCS.   The UCS Logon will fail

You could also test using CURL and Postman which should be easier to validate.  Both of these have failed for us.

We did enable redfish just to test and this was successful and we were able to access the API, but would like to sustain our old xmlapi scripts for the time being for legacy support.

Thank you for your assistance,

Walter

What was the resolution for this?

Review Cisco Networking for a $25 gift card