用于 C# 应用程序的 PHP Web 服务
我想创建一个可从 C# 应用程序使用的 php webservice 服务器。
我想要一个可以自动生成 wsdl 文件以便于管理的库(这就是我选择 NuSoap 的原因)。
我尝试在 PHP5 上使用 nusoap。我对字符集和内容类型有一些问题。
Visual Studio 给出此错误:
HTML 文档不包含Web 服务发现信息。 元数据包含无法解析的引用:“https://www.xxx.yy”。 从网络接收的 XML 有问题。有关更多详细信息,请参阅内部异常。 声明“ISO-8859-1”中的编码与文档“utf-8”的编码不匹配。 如果当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。
<代码> $soap=新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');
函数 bonjour($prenom)
{
返回“Bonjour”.$prenom;
}
?>
有人知道如何改变它以使其兼容并正常工作吗?
谢谢
I want to create a php webservice server to be used from a C# application.
I want to have a library who autogenerate wsdl file for easy management (That's the reason why I choosed NuSoap).
I tried to use nusoap on PHP5. I have some problems with charset and Content-Type.
Visual Studio gives this error :
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;
}
?>
Does someone knows how to change that to make it compliant and working ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到了一个对我来说很有魅力的教程: http://www.sanity- free.com/125/php_webservices_and_csharp_dotnet_soap_clients.html
致以诚挚的问候!
I found finally a tutorial who worked for me like a charm : http://www.sanity-free.com/125/php_webservices_and_csharp_dotnet_soap_clients.html
Best regards !