Hi,
I am trying to retrieve the backup progress via SOAP in PowerShell.
Here my code:
$serverURL = 'https://auc521/platform-services/services/MaintenanceService?wsdl'
$soapRequest = [xml]@"
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.api.platform.vos.cisco.com">
<soapenv:Header/>
<soapenv:Body>
<ser:getBackupProgress/>
</soapenv:Body>
</soapenv:Envelope>
"@
$ciscoUser = 'admin'
$ciscoPwd = 'UC123456!'
$header = @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($ciscoUser+":"+$ciscoPwd))}
$result = Invoke-WebRequest -Uri $serverURL -Headers $header -Method Post -Body $soapRequest -ContentType "text/xml"
$SOAP = $result.Content
$SOAP | Out-File -FilePath $logFile
The response I get is the following:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getBackupProgressResponse xmlns:ns="http://services.api.platform.vos.cisco.com">
<ns:return xmlns:ax214="http://api.platform.vos.cisco.com/xsd" xmlns:ax213="http://element.services.api.platform.vos.cisco.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax213:MaintenanceResponse">
<ax213:remoteMessages xsi:type="ax213:RemoteMessage">
<ax214:error>true</ax214:error>
<ax214:info>false</ax214:info>
<ax214:messageKey>error.validation.required</ax214:messageKey>
<ax214:messageType>internal.message.error</ax214:messageType>
<ax214:warning>false</ax214:warning>
<ax213:messageParams>wsa.replyto</ax213:messageParams>
</ax213:remoteMessages>
<ax213:result>internal.request.failed</ax213:result>
<ax213:backupProgressResult xsi:nil="true" />
<ax213:startBackupResult xsi:nil="true" />
<ax213:updateScheduleResult xsi:nil="true" />
</ns:return>
</ns:getBackupProgressResponse>
</soapenv:Body>
</soapenv:Envelope>
Can you please help me to fix it?
Thanks in advance
Ruben
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It looks like the WS-Addressing info (which is required for PAWS requests) has not been included in the request XML. See the developer guide for more details: https://developer.cisco.com/site/paws/documents/api-reference/#web-service-addressing
This request seems to work on my 10.5 lab system:
POST https://ds-ucm105.cisco.com:8443/platform-services/services/MaintenanceService.MaintenanceServiceHttpsSoap12Endpoint/ HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: application/soap+xml;charset=UTF-8;action="urn:getBackupProgress" Content-Length: 634 Host: ds-ucm105.cisco.com:8443 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) Authorization: Basic QWRtaW5pc3RyYXRvcjpjaXNjb3BzZHQ= <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://services.api.platform.vos.cisco.com"> <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Action>urn:getBackupProgress</wsa:Action> <wsa:ReplyTo> <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address> </wsa:ReplyTo> <wsa:MessageID>uuid:dc75e529-34fb-4009-b594-d801ec86f39e</wsa:MessageID> </soap:Header> <soap:Body> <ser:getBackupProgress/> </soap:Body> </soap:Envelope>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thank you for the fast feedback :-)
I exchanged the variable content as suggested. My lines look as follows:
$soapRequest = [xml]@"
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://services.api.platform.vos.cisco.com">
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>urn:getBackupProgress</wsa:Action>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>uuid:dc75e529-34fb-4009-b594-d801ec86f39e</wsa:MessageID>
</soap:Header>
<soap:Body>
<ser:getBackupProgress/>
</soap:Body>
</soap:Envelope>
"@
The response I get is: The remote server returned an error: (500) Internal Server Error.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The XML portion seems to work copy/pasting and executing with soapUI for me against CUCM 10.5:
- Are you able to successful do a similar request using another tool (soapUI) or mechanism?
- Can you confirm the PAWS service is enabled on CUCM? Getting Started
- Can you capture the raw HTTP request, either somehow via power tools script, or by using something like Fiddler2?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just downloaded Fiddler2 and could enable the SSL decryption! - Great hint! :-)
Here is the TextView:
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action></soapenv:Header><soapenv:Body><soapenv:Fault><faultcode>soapenv:VersionMismatch</faultcode><faultstring>Transport level information does not match with SOAP Message namespace URI</faultstring><detail><Exception>org.apache.axis2.AxisFault: Transport level information does not match with SOAP Message namespace URI
...
</Exception></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Found than that changing the content type to: application/soap+xml works!!!
Thank you very much!
Kind regards
Ruben
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comments
0 comments
Please sign in to leave a comment.