Click here to Skip to main content
15,912,977 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I created web service using asp.net framework 4 :
C#
[WebMethod] 
public DataSet GetMembers(string memberId, string thirdName) 
{ 
string connStr = ConfigurationManager.ConnectionStrings["conStr"].ConnectionString; 
SqlConnection cn = new SqlConnection(connStr); 
SqlDataAdapter da = new SqlDataAdapter(); 
DataSet ds = new DataSet();

da.SelectCommand = new SqlCommand(@"SELECT MemberMaster.MemberId,MemberMaster.FirstName,MemberMaster.SecondName,MemberMaster.ThirdName,MemberMaster.CivilNo,MemberMaster.DateOfBirth,MemberSubcription.MemberId
                                        FROM MemberMaster inner join MemberSubcription on MemberMaster.MemberId=MemberSubcription.MemberId
                                        WHERE MemberMaster.MemberId=@MemberId and MemberMaster.ThirdName=@ThirdName", cn);
    da.SelectCommand.Parameters.Add("@MemberId", SqlDbType.NVarChar).Value = memberId;
    da.SelectCommand.Parameters.Add("@ThirdName", SqlDbType.NVarChar).Value = thirdName;

    ds.Clear();
    da.Fill(ds);
    return ds;
}


it work good in localhost but when i call it in the php :
PHP
    <?php

$wsdlUrl = "http://xxxx/WS/WebService.asmx?WSDL";  

$client = new soapclient($wsdlUrl);

$params = array('memberId' => 'W1100045',
'thirdName' => 'Ali');              

$result = $client->GetMembers($params);

$echoText = '';

if (is_null($result->GetMembersResult))
{

echo "no result";
}

else
{
  echo $result->GetMembersResult;
}

?>


this error appear : Catchable fatal error: Object of class stdClass could not be converted to string on line 23

what is the problem and how can i solve this problem ?
Posted
Comments
Prasad Khandekar 15-Apr-13 7:09am    
Do not return DataSet or Net Specific classes from your .Net web service. Instead create a custom class and return an array of this class instances. Here (http://msdn.microsoft.com/en-us/magazine/cc188755.aspx) is a good reference on this topic.


Regards,
tranesyasd 15-Apr-13 14:47pm    
how can i do it ?

1 solution

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