Up to recently the web scraping of HP warranty information worked fine, however in the last couple of weeks they have changed the web page and it seems they are using POST rather than GET now on the new page, meaning I can't really just pass the information to the URL.
I did find some hope in a solution on this page:
http://ocdnix.wordpress.com/2013/03/14/hp-server-warranty-via-the-isee-api/
But I don't understand the example script as I have not worked with Python before.
I also found this web page that shows me a good example for Dell warranty, But HP don't have a WSDL that I could work with. (I would post the link but don't have enough rep)
Using these functions I can form the request:
http://www.iislogs.com/steveschofield/execute-a-soap-request-from-powershell
I think everything will work as expected but I am struggling to form the request to register the client, I keep getting 500 errors which either means their server is broken or my request is causing an internal error.
I am for the first time completely at a loss with this.
Anybody got this to work in PowerShell or having similar issues?
Updated 22-10-13
I now have the envelope, I managed to get the Python script to run but that failed because of my proxy, so extracted the generated XML which is what I wanted as I wasn't sure how it should be formed, this looks like:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:iseeReg="http://www.hp.com/isee/webservices/">
<SOAP-ENV:Body>
<iseeReg:RegisterClient2>
<iseeReg:request><isee:ISEE-Registration xmlns:isee="http://www.hp.com/schemas/isee/5.00/event" schemaVersion="5.00">
<RegistrationSource>
<HP_OOSIdentifiers>
<OSID>
<Section name="SYSTEM_IDENTIFIERS">
<Property name="TimestampGenerated" value="2013/10/22 09:40:35 GMT Standard Time"/>
</Section>
</OSID>
<CSID>
<Section name="SYSTEM_IDENTIFIERS">
<Property name="CollectorType" value="MC3"/>
<Property name="CollectorVersion" value="T05.80.1 build 1"/>
<Property name="AutoDetectedSystemSerialNumber" value="10"/>
<Property name="SystemModel" value="HP ProLiant"/>
<Property name="TimestampGenerated" value="2013/10/22 09:40:35 GMT Standard Time"/>
</Section>
</CSID>
</HP_OOSIdentifiers>
<PRS_Address>
<AddressType>0</AddressType>
<Address1/>
<Address2/>
<Address3/>
<Address4/>
<City/>
<Region/>
<PostalCode/>
<TimeZone/>
<Country/>
</PRS_Address>
</RegistrationSource>
<HP_ISEECustomer>
<Business/>
<Name/>
</HP_ISEECustomer>
<HP_ISEEPerson>
<CommunicationMode>255</CommunicationMode>
<ContactType/>
<FirstName/>
<LastName/>
<Salutation/>
<Title/>
<EmailAddress/>
<TelephoneNumber/>
<PreferredLanguage/>
<Availability/>
</HP_ISEEPerson>
</isee:ISEE-Registration></iseeReg:request>
</iseeReg:RegisterClient2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I then built a Powershell script that executes like this:
function Execute-SOAPRequest {
Param (
[Xml]$SOAPRequest,
[String]$URL,
[switch]$UseProxy
)
write-host "Sending SOAP Request To Server: $URL"
$soapWebRequest = [System.Net.WebRequest]::Create($URL)
$soapWebRequest.Headers.Add("SOAPAction",'"http://www.hp.com/isee/webservices/RegisterClient2"')
$soapWebRequest.ContentType = 'text/xml; charset=utf-8'
$soapWebRequest.Accept = "text/xml"
$soapWebRequest.Method = "POST"
$soapWebRequest.UserAgent = 'RemoteSupport/A.05.05 - gSOAP/2.7'
#$soapWebRequest.ServicePoint.Expect100Continue = $False
#$soapWebRequest.ServicePoint.MaxIdleTime = 2000
$soapWebRequest.ProtocolVersion = [system.net.httpversion]::version10
if($UseProxy){
$soapWebRequest.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
}
write-host "Initiating Send."
$requestStream = $soapWebRequest.GetRequestStream()
$SOAPRequest.Save($requestStream)
$requestStream.Close()
write-host "Send Complete, Waiting For Response."
$resp = $soapWebRequest.GetResponse()
$responseStream = $resp.GetResponseStream()
$soapReader = [System.IO.StreamReader]($responseStream)
$ReturnXml = [Xml]$soapReader.ReadToEnd()
$responseStream.Close()
write-host "Response Received."
return $ReturnXml
}
$SOAPRequest = [Xml](Get-Content 'C:\Temp\SoapEnv.xml')
$URL = 'https://services.isee.hp.com/ClientRegistration/ClientRegistrationService.asmx'
Execute-SOAPRequest $SOAPRequest $URL -UseProxy
But now I am getting additional errors rather than the 500 I was getting so getting closer?? Error details are:
Exception calling "GetRequestStream" with "0" argument(s): "The server committed a protocol violation. Section=ResponseStatusLine"
At C:\Temp\HP Register Client.ps1:29 char:54
+ $requestStream = $soapWebRequest.GetRequestStream <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
try this. . works for me just fine: Note: Only the request tag needs to be escaped.
$SOAPRequest= [xml]@"
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:iseeReg="http://www.hp.com/isee/webservices/">
<SOAP-ENV:Body>
<iseeReg:RegisterClient2>
<iseeReg:request><isee:ISEE-Registration xmlns:isee="http://www.hp.com/schemas/isee/5.00/event" schemaVersion="5.00">
<RegistrationSource>
<HP_OOSIdentifiers>
<OSID>
<Section name="SYSTEM_IDENTIFIERS"&g`enter code here`t;
<Property name="TimestampGenerated" value="2013/12/06 14:04:24 EST"/>
</Section>
</OSID>
<CSID>
<Section name="SYSTEM_IDENTIFIERS">
<Property name="CollectorType" value="MC3"/>
<Property name="CollectorVersion" value="T05.80.1 build 1"/>
<Property name="AutoDetectedSystemSerialNumber" value="10"/>
<Property name="SystemModel" value="HP ProLiant"/>
<Property name="TimestampGenerated" value="2013/12/06 14:04:24 EST"/>
</Section>
</CSID>
</HP_OOSIdentifiers>
<PRS_Address>
<AddressType>0</AddressType>
<Address1/>
<Address2/>
<Address3/>
<Address4/>
<City/>
<Region/>
<PostalCode/>
<TimeZone/>
<Country/>
</PRS_Address>
</RegistrationSource>
<HP_ISEECustomer>
<Business/>
<Name/>
</HP_ISEECustomer>
<HP_ISEEPerson>
<CommunicationMode>255</CommunicationMode>
<ContactType/>
<FirstName/>
<LastName/>
<Salutation/>
<Title/>
<EmailAddress/>
<TelephoneNumber/>
<PreferredLanguage/>
<Availability/>
</HP_ISEEPerson>
</isee:ISEE-Registration></iseeReg:request>
</iseeReg:RegisterClient2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
"@
You'll have to do the same thing for the warranty xml like so then just re-run the soap web request.
$hpgdid = $ReturnXml.envelope.body.RegisterClient2Response.RegisterClient2Result.Gdid
$hptoken = $ReturnXml.envelope.body.RegisterClient2Response.RegisterClient2Result.registrationtoken
$warrantyxml = [xml]@"
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:isee="http://www.hp.com/isee/webservices/">
<SOAP-ENV:Header>
<isee:IseeWebServicesHeader>
<isee:GDID>$hpgdid</isee:GDID>
<isee:registrationToken>$hptoken</isee:registrationToken>
<isee:OSID/>
<isee:CSID/>
</isee:IseeWebServicesHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<isee:GetOOSEntitlementList2>
<isee:request>
<isee:ISEE-GetOOSEntitlementInfoRequest
xmlns:isee="http://www.hp.com/schemas/isee/5.00/entitlement"
schemaVersion="5.00">
<HP_ISEEEntitlementParameters>
<CountryCode>ES</CountryCode>
<SerialNumber>CZ10130050</SerialNumber>
<ProductNumber>519841-425</ProductNumber>
<EntitlementType></EntitlementType>
<EntitlementId></EntitlementId>
<ObligationId></ObligationId>
</HP_ISEEEntitlementParameters>
</isee:ISEE-GetOOSEntitlementInfoRequest>
</isee:request>
</isee:GetOOSEntitlementList2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
"@
$xmlstring = [string]$ReturnXml.Envelope.Body.GetOOSEntitlementList2Response.GetOOSEntitlementList2Result.Response
$warranty_info = [xml]@"
$xmlstring
"@
$warranty_info."ISEE-GetOOSEntitlementInfoResponse"
I have built this into a PowerShell Module, I moved the SOAP Requests to separate XML files, and used CDATA to make them much more readable. It works pretty well for me. it can be found on GitHub:
https://github.com/dotps1/HPWarranty
Thanks for all of the info on this page, really helped!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With