I am getting "Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'" after implementing below code. Please help to investigate the issue.
I tried the same service with SOAP UI and its success. After changing the SOAP version to 1.1 I am getting the same message with SOAP UI too.
sample code
<?php
$context = stream_context_create([
'ssl' => [
'soap_version' => SOAP_1_2,
'verify_peer' => false,
'verify_peer_name' => false,
'connection_timeout' => 1
]
]);
$requestParams = '<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<CustomHeader xmlns="http://schemas.test.com/CustomHeader">
</CustomHeader>
</s:Header>
<s:Body>
</s:Body>
</s:Envelope>';
$client = new SoapClient('https://myservice.svc?singlewsdl', array('stream_context' => $context));
$client->__setLocation('https://myservice.svc');
$response = $client->__soapCall('mymethod', array($requestParams));
?>