I'm using a method using SoapClient class in a php page to call a web service in an asp.net site.
Here is the php code.
$client = new SoapClient("http://testurl/Test.asmx?WSDL");
$params = array( 'Param1' => 'Hello',
'Param2' => 'World!');
$result = $client->TestMethod($params)->TestMethodResult;
echo $result;
The problem is, I'm only getting the first parameter (Param1) "Hello" back and seems like there is an issue with Param2. Here is the asp.net method.
[WebMethod]
public string TestMethod(string Param1, string Param2)
{
return Param1 + " " + Param2;
}
What am I missing to get Hello World!
in the response?
Try like this:
$client = new SoapClient("http://testurl/Test.asmx?WSDL");
$params->Param1 = 'Hello';
$params->Param2 = 'World!';
$result = $client->TestMethod($params)->TestMethodResult;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With