NuSoap - 设置自定义内容类型

时间:2012-10-24 12:48:07

标签: php web-services webservice-client nusoap

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

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>';

任何帮助将不胜感激

0 个答案:

没有答案