2013-06-19 207 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); 

相關: