我想创建一个要从 C# 应用程序使用的 php webservice 服务器。
我想要一个自动生成 wsdl 文件以便于管理的库(这就是我选择 NuSoap 的原因)。
我尝试在 PHP5 上使用 nusoap。我对 charset 和 Content-Type 有一些问题。
Visual Studio 给出了这个错误:
The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'https://www.xxx.yy'.
There is a problem with the XML that was received from the network. See inner exception for more details.
The encoding in the declaration 'ISO-8859-1' does not match the encoding of the document 'utf-8'.
If the service is defined in the current solution, try building the solution and adding the service reference again.
$soap= new soap_server();
$soap->xml_encoding = 'utf-8';
$soap->configureWSDL('Bonjour', 'https://www.xxx.yy');
$soap->wsdl->schemaTargetNamespace = 'http://soapinterop.org/xsd/';
$soap->register('bonjour', array('prenom' => 'xsd:string'));
$HTTP_RAW_POST_DATA = file_get_contents("php://input");
$soap->service($HTTP_RAW_POST_DATA);
header('Content-Type: application/soap+xml; charset=utf-8');
function bonjour($prenom)
{
return "Bonjour ".$prenom;
}
?>
有人知道如何改变它以使其兼容和工作吗?
谢谢