我有一个使用 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