【发布时间】:2011-11-09 03:56:51
【问题描述】:
我有一个使用 NuSOAP 库构建的 PHP Web 服务。我已经调整了 Web 服务以与 Windows Phone 一起使用,一切似乎都很好。
问题是当我收到回复时,我收到了 CommunicationException。我认为那是无法识别 ?wsdl 的端点的 url。
我搜索了有关它的信息,但找不到任何解决方法。
我的代码如下:
private void button1_Click(object sender, RoutedEventArgs e)
{
var test = new TS.TestWSDLPortTypeClient();
test.sumarCompleted += test_sumarCompleted;
test.sumarAsync(3, 4);
}
void test_sumarCompleted(object sender, TS.sumarCompletedEventArgs e)
{
MessageBox.Show(e.Result.ToString();
}
还有我的 .ClientConfig
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TestWSDLBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.1.38/ws_test.php" binding="basicHttpBinding"
bindingConfiguration="TestWSDLBinding" contract="TestWSDL.TestWSDLPortType"
name="TestWSDLPort" />
</client>
</system.serviceModel>
</configuration>
我也测试过:
<endpoint address="http://192.168.1.38/ws_test.php?wsdl"...
我也用域名测试过,ip:127.0.0.1,其他端口等
PHP代码是:
#Declaración del servidor nusoap
$server = new soap_server();
$server->configureWSDL("TestWSDL","urn:TestWSDL", "http://libreriacloud.sytes.net/ws_monster/ws_test.php?wsdl");
$server->soap_defencoding = 'UTF-8';
#Registro de la Funcion Sumar
$server->register(
'sumar',
array(
'x' => 'xsd:int',
'y' => 'xsd:int'
),
array('return' => 'xsd:int'),
'urn:TestWSDL',
'urn:TestWSDL/sumar',
'document',
'literal',
'Suma dos datos'
);
function sumar($x, $y)
{
return $x+$y;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
WSDL 网址是:http://libreriacloud.sytes.net/ws_monster/ws_test.php
【问题讨论】:
-
我想知道您是否可以提供更多信息。听起来您尝试将客户端中的服务引用添加到 ws_test.php 服务没有成功。您是否使用 Visual Studio 中的添加服务引用功能执行此操作?当你尝试时会发生什么? client/endpoint/@address 不应引用 ?wsdl URL,它是一种用于查找元数据交换端点的临时协议(/mex 已成为其标准)。您是否有机会在公共服务器上托管示例 php 服务,以便我们可以构建一个工作示例客户端?
-
这是一篇博文,Testing the NuSOAP Webservice in C#,它似乎很好地解释了如何在 NuSOAP 中添加对 php 服务的服务引用。这与您一直在尝试的方法相比如何?
-
我工作的例子,但是当我按要求做时,异步 Windows Phone 停止工作
标签: php web-services windows-phone-7 wsdl communicationexception