2

我正在使用 NuSoap 向 Web 服务发出肥皂请求,因为 Soap 未安装在我使用的 Web 服务器上,但得到以下响应:

Response

HTTP/1.1 415 Cannot process the message because the content type 'text/xml; charset=ISO-8859-1' was not the expected type 'multipart/related; type="application/xop+xml"'.
Server: Microsoft-IIS/7.5
MIME-Version: 1.0
X-Powered-By: ASP.NET
Date: Wed, 24 Oct 2012 12:37:06 GMT
Content-Length: 0

如何设置内容类型以适应上述请求?

这是我的代码

require_once('lib/nusoap.php');
$client = new soapclient('https://www.propctrl.com/v2/Integration.svc?wsdl',array('soap_version'=>1));
$headers = '
<CredentialsHeader>\n
<Username>username</Username>\n
<Password>password</Password>\n           
</CredentialsHeader>
';

$client->setHeaders($headers);

//var_dump($client);
$err = $client->getError();
if ($err) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
//$result = $client->call('getCredits',array('roland','r0l@nd'));
$result = $client->call('EchoAuthenticated',array("text"=>"Some text"));

echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

任何帮助,将不胜感激

4

0 回答 0