My nusoap call is like this
require_once('lib/nusoap.php');
$headers = array( 'Content-Type: application/xml',
'Authorization: Bearer ZGMK' );
$client = new nusoap_client("http://test.wsdl?wsdl", array('soap_version' => SOAP_1_2,));
$client->setUseCURL(true);
$client->setCurlOption(CURLOPT_SSLVERSION, '6'); // TLS 1.2
$client->setCurlOption(CURLOPT_SSLCERT, 'C:\xampp\htdocs\test\test.pem'); // TLS 1.2
$client->setCurlOption(CURLOPT_SSLCERTPASSWD, 'pass');
$client->setCurlOption(CURLOPT_HTTPHEADER, $headers);
$client->soap_defencoding = 'UTF-8';
$result = $client->call("Terminate", array("type" => "Main"));
$error = $client->getError();
if ($error) {
echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}
if ($client->fault) {
echo "<h2>Fault</h2><pre>";
print_r($result);
echo "</pre>";
} else {
$error = $client->getError();
if ($error) {
echo "<h2>Error</h2><pre>" . $error . "</pre>";
} else {
echo "<h2>Main</h2>";
echo $result;
}
}
// show soap request and response
echo "<h2>Request</h2>";
echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>";
echo "<h2>Response</h2>";
echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>";
All looks good to me but it throws an error like this
HTTP Error: Unsupported HTTP response status 415 Unsupported Media Type (soapclient->response has contents of the response)
On my initial google search, I found it is related to SOAP version or content type. so I put some code to set them too (available above). but still, I am getting the same error. and my request log shows the content type as text/xml
only.
Request
POST /endpoint HTTP/1.0
Host: domain:4046
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "https://terminate"
Content-Length: 424
Response
HTTP/1.1 415 Unsupported Media Type
Content-Length: 0
Content-Type: application/octet-stream
Date: Thu, 14 Feb 2019 11:35:04 GMT
Set-Cookie: HTTS008_001=!OpEB2CQQrC0ndIOtQCYvmLkbG3BVmQACyOEYvjJ4Y4ez8YLdDu0Vy5H/6dTFAf3WFjp8gW/ATWV0pIKPAn14Ph8O6cmOy1LfRGgPaKVll2YQNQ==; path=/; Httponly; Secure
Can anyone point out what I am doing wrong here?