我使用 asp.net 框架 4 创建了 Web 服务:
[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;
}
它在 localhost 中运行良好,但是当我在 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;
}
?>
出现此错误:Catchable fatal error: Object of class stdClass could not be convert to string on line 23
有什么问题,我该如何解决这个问题?