Hi!
I've begun to use the same SMARTAIR SOAP API with PowerShell but always receiving the error: "Invoke-WebRequest : The remote server returned an error: (415) Unsupported Media Type.". For example with the following code:
Any help will be appreciated.
Regards, Fernando.
Solved!! :D
I had got to add -ContentType 'text/xml' in Invoke-WebRequest
I've begun to use the same SMARTAIR SOAP API with PowerShell but always receiving the error: "Invoke-WebRequest : The remote server returned an error: (415) Unsupported Media Type.". For example with the following code:
Code:
$Body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.ws.ts1000.tesa.es/">
<soapenv:Header/>
<soapenv:Body>
<soap:lockingPlanModify>
<operatorName>user</operatorName>
<operatorPassword>XXXXXX</operatorPassword>
<userId>274</userId>
<doorId>118</doorId>
<canOpen>true</canOpen>
<codTimetable>15</codTimetable>
<privacyOverride>true</privacyOverride>
</soap:lockingPlanModify>
</soapenv:Body>
</soapenv:Envelope>'
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$Response = Invoke-WebRequest -Uri 'https://localhost:8181/TesaSmartairPlatform/LockingPlanWebService' -Method Post -Body $Body
Any help will be appreciated.
Regards, Fernando.
Solved!! :D
I had got to add -ContentType 'text/xml' in Invoke-WebRequest
Code:
Invoke-WebRequest -Uri 'https://localhost:8181/TesaSmartairPlatform/LockingPlanWebService' -Method 'Post' -Body $Body -ContentType 'text/xml'