我想创建一个从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;
}
?>
有人知道如何改变它以使其符合并且有效吗?
由于
答案 0 :(得分:1)
我终于找到了一个为我工作的教程,就像一个魅力:http://www.sanity-free.com/125/php_webservices_and_csharp_dotnet_soap_clients.html
祝你好运!