PHP SOAP不支持HTTP响应状态415

时间:2017-05-17 10:22:46

标签: php wcf soap

我正在使用nusoap从WCF服务器获取带有以下代码的结果:

require_once "nuSoap/lib/nusoap.php";
$client = new nusoap_client("http://example.com/?wsdl");

$error = $client->getError();
if ($error) {
    echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}

$result = $client->call("Add", array("x" => "5","y"=>"3"));

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>Books</h2><pre>";
        echo $result;
        echo "</pre>";
    }
}

但是我收到了这个错误:

HTTP Error: Unsupported HTTP response status 415 Cannot process the message because the content type 'text/xml; charset=ISO-8859-1' was not the expected type 'application/soap+xml; charset=utf-8'. (soapclient->response has contents of the response)

如果我尝试从服务器获取函数它工作正常,返回我可以在数组中使用的所有函数。我也尝试过常规的肥皂,我收到了这个错误:

SoapFault exception: [HTTP] Bad Request in /public_html/soapScript.php:25 Stack trace: #0 [internal function]: SoapClient->__doRequest('__call('Add', Array) #2 /public_html/soapScript.php(25): SoapClient->Add(Array) #3 {main}

我不知道我做错了什么,为什么它不能像它应该那样工作。我尝试了不同的例子,但仍然没有。

0 个答案:

没有答案
相关问题