Until recently, web scraping of HP warranty information worked fine, but over the past couple of weeks they have changed the web page and it looks like they are using POST and not GET now on a new page, that is, I canโt really just pass the URL information .
I found hope in a solution on this page:
http://ocdnix.wordpress.com/2013/03/14/hp-server-warranty-via-the-isee-api/
But I do not understand the example script, since I had not worked with Python before.
I also found this web page that shows me a good example of a Dell warranty, but HP does not have a WSDL that I could work with. (I would post a link, but did not have enough rep)
Using these functions, I can form a request:
http://www.iislogs.com/steveschofield/execute-a-soap-request-from-powershell
I think that everything will work as expected, but I'm struggling to generate a request for client registration, I continue to receive 500 errors, which either mean that their server is damaged, or my request causes an internal error.
The first time I completely lost it.
Has anyone got this to work in PowerShell or have similar problems?
Updated 10-22-13
Now I have an envelope, I managed to run a Python script, but it did not succeed because of my proxy server, so I extracted the received XML code, which I wanted, because I was not sure how it should be generated, it looks like this :
<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>
Then I built a Powershell script that runs as follows:
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 get additional errors, not 500, with which I was getting closer? Error Details:
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