2013-06-19 229 views
0

我在Visual Studio MyWebService.asmx中测试过,它工作正常。从PHP调用.NET Web服务

当我从php页面运行它时,我得到了未提供的visual studio参数的异常。 我猜php代码有问题。

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

回答

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); 

相关: