Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,
I am new to web services and also Php,
Here i am trying to consume the Wcf service from php(wamp server)

this is my php code

PHP
<?php

try{
require_once ('lib/nusoap.php');
  $client = new SoapClient("http://localhost:51732/Service1.svc?wsdl");

$params = array('value' => '10');

// Call web service PassMember methordd
 $webService = $client-> GetData($parms);
 $wsResult = $webService->GetDataResult();

 print_r($wsResult);

       } catch (Exception $e) {
       echo 'Caught exception:',  $e->getMessage(), "\n";
}
?>



this is my method in service
-------------------------------

C#
namespace First
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
    }
}



but i got the error like this

Fatal error: Call to undefined method stdClass::GetDataResult() in C:\wamp\www\first.php on line 14


So help me to solve this

thanks in advance
Posted
Updated 15-Jul-15 0:05am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900