08-09-2017 06:58 AM - last edited on 03-01-2019 01:16 PM by NikolaIvanov
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
08-11-2017 08:52 PM
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
08-14-2017 05:43 AM
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.
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
11-01-2017 01:27 PM
What was the resolution for this?
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