0

我在 Visual Studio MyWebService.asmx 中进行了测试,它可以工作。

当我从 php 页面运行它时,我在未提供的 Visual Studio 参数中出现异常。我猜php代码有问题。

<?php 
    $client = new SoapClient("http://localhost:1144/MyWebService.asmx?WSDL");
    $arr = $client->PhpWebMethod($_GET['searchtxt']);
    print_r($arr);
?>
4

1 回答 1

2
$url = 'http://localhost:1144/MyWebService.asmx?WSDL';
$client = new SoapClient($url);

$xmlr = new SimpleXMLElement("<Get></Get>");
$xmlr->addChild('searchtxt', $_GET['searchtxt']);

$params = new stdClass();
$params->xml = $xmlr->asXML();

$result = $client->PhpWebMethod($params);

有关的:

于 2013-06-21T02:11:23.990 回答