I'm trying to consume a soap webservice with nusoap in php and I get the following error:
ErrorHTTP Error: Unsupported HTTP response status 415 Can not process the message because the content type 'text / xml; charset = UTF-8 'was not the expected type 'application / soap + xml; charset = utf-8 '. (soapclient-> response has contents of the response) HTTP Error: Unsupported HTTP response status 415 Can not process the message because the content type 'text / xml; charset = UTF-8 'was not the expected type 'application / soap + xml; charset = utf-8 '. (soapclient-> response has contents of the response)
This is my code:
$user = 'xxxx';
$password = 'xxxx';
$wsdl = "miwebservice?wsdl";
$client = new nusoap_client($wsdl);
$client->soap_defencoding = 'UTF-8';
$client->setHeaders('application/soap+xml; charset=UTF-8');
$err = $client->getError();
if ($err) { die('Error en Constructor' . $err ); }
$client->setCredentials($user, $password, 'basic');
$Params= array(
'param1'=> $var1,
'param2'=> $var2,
'param4'=> $var3,
'param5'=> $var4,
'param6'=> $var5,
'param7'=> $var6
);
//dd($Params);
$result = $client->call('funcion', $Params);
if ($client->fault) {
echo 'Fallo';
print_r($result);
} else { // Chequea errores
$err = $client->getError();
if ($err) { // Muestra el error
echo 'Error' . $err ;
} else { // Muestra el resultado
echo 'Resultado';
print_r ($result);
}
}