【问题标题】:calling .NET Web service from PHP从 PHP 调用 .NET Web 服务
【发布时间】:2013-06-19 14:45:01
【问题描述】:

我在 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);
?>

【问题讨论】:

    标签: php .net soap-client


    【解决方案1】:
    $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);
    

    相关:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-19
      • 1970-01-01
      相关资源
      最近更新 更多