I made a WCF service using C#. My colleague wants to consume this service.
I my service I have to methods, 'Test' wich returns a simple string and 'TestString2', which needs a parameter and mulitplies this value bij 2 and returns this as a string
We're using the next code to invoke a the Test method
This works fine and $data has the string that is returned.Code://trying to connect echo("<br/>Trying to connect<br />"); $client = new SoapClient($SOAP_BASE); $data = $client->Test(); var_dump($data);
But when we try to call the method with parameter we get an exception:
Fatal error: Uncaught SoapFault exception: [Client] Function ("TestString2") is not a valid method for this service in <url>/test.php:29 Stack trace: #0 [internal function]: SoapClient->__call('TestString2', Array) #1 <url>/test.php(29): SoapClient->TestString2(Array) #2 {main} thrown in <url>/test.php on line 29Code://trying to connect echo("<br/>Trying to connect<br />"); $client = new SoapClient($SOAP_BASE); $data = $client->TestString2(10); var_dump($data);
It looks like it needs an array as parameter
But it won't work, anyone any idea????Code://trying to connect echo("<br/>Trying to connect<br />"); $client = new SoapClient($SOAP_BASE); //parameter name is 'i' $params= array("i"=> 10); $data = $client->TestString2($params); var_dump($data);




Reply With Quote