I'm calling a webservice from PHP and I get this error:
Cannot process the message because the content type \'text/xml; charset=utf-8\' was not the expected type \'application/x-gzip\'.'
I've to change the Content-Type header of my request but everything I tried failed.
I'm setting the header like this:
$httpHeaders = array(
'http' => array(
'header' => "Content-Type: application/x-gzip; charset=utf-8\r\n".
"Content-Encoding: gzip\r\n",
)
);
$context = stream_context_create($httpHeaders);
$soapparams = array(
'stream_context' => $context,
'trace' => 1,
'exceptions' => 0,
'login' => 'myuser',
'password' => 'mypass',
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
);
$wsdl = 'https://coll.leo-italy.eu/BioGatewayService/wsdl/Aia.BioGateway.Services.BioIZSUMGatewayService.svc?wsdl';
$soap = new SoapClient($wsdl, $soapparams);
These are the header that I get:
'POST /BioGatewayService/Aia.BioGateway.Services.BioIZSUMGatewayService.svc HTTP/1.1
Host: coll.leo-italy.eu
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.2.3RC1
Accept-Encoding: gzip, deflate
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://schemas.siall.it/IBioIZSUMGatewayService/SetAnalisiIZSUM"
Content-Length: 227
Authorization: Basic xxxxxxx
Content-Encoding: gzip
'
The Content-Encoding: gzip is set correctly but the Content-Type is not changing.
Any thougts?