Vladimir Petrovski
Vladimir Petrovski

Reputation: 2106

calling .NET Web service from PHP

I tested in visual studio MyWebService.asmx and it works.

When I run it from the php page, I get exception in visual studio parameter not supplied. I guess there is something wrong with the php code.

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

Upvotes: 0

Views: 189

Answers (1)

denormalizer
denormalizer

Reputation: 2214

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

Related:

Upvotes: 2

Related Questions