# PHP with nusoap accessing a .net web service!



## simonshort (Aug 21, 2004)

I am a total noob when it comes to this. I have tried simply getting a string to be displayed bt cannot get it to work. i have included the code below. I simply want the page to print out "Hello" as stored in the web service

<PHP>
<?php

require_once('nusoap/nusoap.php');
$soapClient = new soapclient("http://localhost/ensembleservice1/Service1.asmx?wsdl", true);
$result = ($soapClient->call("Greeting"));
print_r($result);

?>

<ASMX>
.
.
.
<WebMethod()> _
Public Function Greeting() As String
Return "hello"
End Function
.
.

The output to the web browser is:

Array ( [GreetingResult] => Hello )


----------



## simonshort (Aug 21, 2004)

Ok ive done it...

<?php
require_once('nusoap/nusoap.php');
/* New instance of soapClient */

$soapClient = new soapclient('http://localhost/ensembleservice1/Service1.asmx?WSDL', 'wsdl');
$soapClient->setDefaultRpcParams(true);
/* Set parameters to pass to client */
$param = array (
'myname' =>"Simon" //uses myname from the web service
);
$soapproxy = $soapClient->getProxy();	
$result = $soapproxy->Greeting($param);

if (!$err = $soapproxy->getError()){
echo (implode($result)) . "\n";
}
else{
echo 'Error: ' . $err . "\n";
}

?>


----------



## covert215 (Apr 22, 2006)

mark the thread SOLVED by editing its title


----------

