我使用asp.net framework 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;
}
?>
出现此错误: 可捕获的致命错误:类stdClass的对象无法在第23行转换为字符串
问题是什么?如何解决这个问题?